summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom')
-rw-r--r--Source/WebCore/dom/Attr.h7
-rw-r--r--Source/WebCore/dom/Attr.idl6
-rw-r--r--Source/WebCore/dom/Attribute.cpp2
-rw-r--r--Source/WebCore/dom/Attribute.h37
-rw-r--r--Source/WebCore/dom/BeforeLoadEvent.idl2
-rw-r--r--Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp81
-rw-r--r--Source/WebCore/dom/CSSMappedAttributeDeclaration.h81
-rw-r--r--Source/WebCore/dom/CharacterData.idl10
-rw-r--r--Source/WebCore/dom/ClientRectList.idl2
-rw-r--r--Source/WebCore/dom/Clipboard.h10
-rw-r--r--Source/WebCore/dom/Clipboard.idl2
-rw-r--r--Source/WebCore/dom/ContainerNode.cpp8
-rw-r--r--Source/WebCore/dom/CustomEvent.idl2
-rw-r--r--Source/WebCore/dom/DOMAllInOne.cpp1
-rw-r--r--Source/WebCore/dom/DOMCoreException.idl6
-rw-r--r--Source/WebCore/dom/DOMImplementation.idl20
-rw-r--r--Source/WebCore/dom/DOMStringList.idl2
-rw-r--r--Source/WebCore/dom/DOMStringMap.idl6
-rw-r--r--Source/WebCore/dom/DataTransferItemList.idl4
-rw-r--r--Source/WebCore/dom/DatasetDOMStringMap.cpp50
-rw-r--r--Source/WebCore/dom/Document.cpp83
-rw-r--r--Source/WebCore/dom/Document.h3
-rw-r--r--Source/WebCore/dom/Document.idl216
-rw-r--r--Source/WebCore/dom/DocumentMarkerController.cpp4
-rw-r--r--Source/WebCore/dom/DocumentMarkerController.h2
-rw-r--r--Source/WebCore/dom/DocumentType.idl2
-rw-r--r--Source/WebCore/dom/Element.cpp35
-rw-r--r--Source/WebCore/dom/Element.h67
-rw-r--r--Source/WebCore/dom/Element.idl156
-rw-r--r--Source/WebCore/dom/ElementAttributeData.cpp27
-rw-r--r--Source/WebCore/dom/ElementAttributeData.h12
-rw-r--r--Source/WebCore/dom/ErrorEvent.idl8
-rw-r--r--Source/WebCore/dom/Event.idl12
-rw-r--r--Source/WebCore/dom/EventException.idl6
-rw-r--r--Source/WebCore/dom/EventFactory.in3
-rw-r--r--Source/WebCore/dom/EventListener.idl4
-rw-r--r--Source/WebCore/dom/EventNames.h1
-rw-r--r--Source/WebCore/dom/EventTarget.idl6
-rw-r--r--Source/WebCore/dom/ExceptionCodePlaceholder.cpp4
-rw-r--r--Source/WebCore/dom/ExceptionCodePlaceholder.h1
-rw-r--r--Source/WebCore/dom/HashChangeEvent.idl4
-rw-r--r--Source/WebCore/dom/MappedAttributeEntry.h57
-rw-r--r--Source/WebCore/dom/MessageChannel.idl4
-rw-r--r--Source/WebCore/dom/MessageEvent.idl12
-rw-r--r--Source/WebCore/dom/MessagePort.idl6
-rw-r--r--Source/WebCore/dom/MouseEvent.idl6
-rw-r--r--Source/WebCore/dom/MutationEvent.idl2
-rw-r--r--Source/WebCore/dom/NamedNodeMap.cpp28
-rw-r--r--Source/WebCore/dom/NamedNodeMap.h16
-rw-r--r--Source/WebCore/dom/NamedNodeMap.idl12
-rw-r--r--Source/WebCore/dom/Node.cpp41
-rw-r--r--Source/WebCore/dom/Node.idl38
-rw-r--r--Source/WebCore/dom/NodeFilter.idl6
-rw-r--r--Source/WebCore/dom/NodeIterator.idl2
-rw-r--r--Source/WebCore/dom/NodeList.idl6
-rw-r--r--Source/WebCore/dom/OverflowEvent.idl6
-rw-r--r--Source/WebCore/dom/PageTransitionEvent.idl2
-rw-r--r--Source/WebCore/dom/PopStateEvent.idl2
-rw-r--r--Source/WebCore/dom/ProcessingInstruction.idl2
-rw-r--r--Source/WebCore/dom/ProgressEvent.idl6
-rw-r--r--Source/WebCore/dom/Range.idl6
-rw-r--r--Source/WebCore/dom/RangeException.idl4
-rw-r--r--Source/WebCore/dom/ScriptExecutionContext.cpp14
-rw-r--r--Source/WebCore/dom/ScriptExecutionContext.h9
-rw-r--r--Source/WebCore/dom/SelectorQuery.cpp10
-rw-r--r--Source/WebCore/dom/ShadowRoot.cpp46
-rw-r--r--Source/WebCore/dom/ShadowRoot.h10
-rw-r--r--Source/WebCore/dom/ShadowRoot.idl6
-rw-r--r--Source/WebCore/dom/StyledElement.cpp252
-rw-r--r--Source/WebCore/dom/StyledElement.h54
-rw-r--r--Source/WebCore/dom/TouchList.idl2
-rw-r--r--Source/WebCore/dom/TreeWalker.idl2
-rw-r--r--Source/WebCore/dom/UIEvent.idl2
-rw-r--r--Source/WebCore/dom/WebKitAnimationEvent.idl4
-rw-r--r--Source/WebCore/dom/WebKitMutationObserver.cpp3
-rw-r--r--Source/WebCore/dom/WebKitNamedFlow.idl2
-rw-r--r--Source/WebCore/dom/WebKitTransitionEvent.idl4
-rw-r--r--Source/WebCore/dom/make_event_factory.pl15
78 files changed, 750 insertions, 944 deletions
diff --git a/Source/WebCore/dom/Attr.h b/Source/WebCore/dom/Attr.h
index 7b6e332ee..0209f9041 100644
--- a/Source/WebCore/dom/Attr.h
+++ b/Source/WebCore/dom/Attr.h
@@ -30,6 +30,8 @@
namespace WebCore {
+class CSSStyleDeclaration;
+
// Attr can have Text and EntityReference children
// therefore it has to be a fullblown Node. The plan
// is to dynamically allocate a textchild and store the
@@ -55,8 +57,9 @@ public:
bool isId() const;
- // An extension to get presentational information for attributes.
- CSSStyleDeclaration* style() { return m_attribute->decl(); }
+ // A deprecated extension to get presentational information for attributes.
+ // We have to keep it around because it's exposed in the Obj-C DOM API.
+ CSSStyleDeclaration* style() { return 0; }
void setSpecified(bool specified) { m_specified = specified; }
diff --git a/Source/WebCore/dom/Attr.idl b/Source/WebCore/dom/Attr.idl
index 992a03b96..e3a802cf2 100644
--- a/Source/WebCore/dom/Attr.idl
+++ b/Source/WebCore/dom/Attr.idl
@@ -21,8 +21,8 @@
module core {
interface [
- CustomMarkFunction,
- GenerateNativeConverter
+ JSCustomMarkFunction,
+ JSGenerateToNativeObject
] Attr : Node {
// DOM Level 1
@@ -31,7 +31,7 @@ module core {
readonly attribute boolean specified;
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString value
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString value
setter raises(DOMException);
// DOM Level 2
diff --git a/Source/WebCore/dom/Attribute.cpp b/Source/WebCore/dom/Attribute.cpp
index 7ed28d83c..5164560b5 100644
--- a/Source/WebCore/dom/Attribute.cpp
+++ b/Source/WebCore/dom/Attribute.cpp
@@ -40,7 +40,7 @@ static AttributeAttrMap& attributeAttrMap()
PassRefPtr<Attribute> Attribute::clone() const
{
- return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute, m_mappedAttributeDeclaration.get()));
+ return adoptRef(new Attribute(m_name, m_value));
}
Attr* Attribute::attr() const
diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h
index 938e1922d..8658775b8 100644
--- a/Source/WebCore/dom/Attribute.h
+++ b/Source/WebCore/dom/Attribute.h
@@ -25,13 +25,11 @@
#ifndef Attribute_h
#define Attribute_h
-#include "CSSMappedAttributeDeclaration.h"
#include "QualifiedName.h"
namespace WebCore {
class Attr;
-class CSSStyleDeclaration;
class Element;
class NamedNodeMap;
@@ -43,15 +41,11 @@ class Attribute : public RefCounted<Attribute> {
public:
static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value)
{
- return adoptRef(new Attribute(name, value, false, 0));
+ return adoptRef(new Attribute(name, value));
}
- static PassRefPtr<Attribute> createMapped(const QualifiedName& name, const AtomicString& value)
+ static PassRefPtr<Attribute> create(const AtomicString& name, const AtomicString& value)
{
- return adoptRef(new Attribute(name, value, true, 0));
- }
- static PassRefPtr<Attribute> createMapped(const AtomicString& name, const AtomicString& value)
- {
- return adoptRef(new Attribute(name, value, true, 0));
+ return adoptRef(new Attribute(name, value));
}
const AtomicString& value() const { return m_value; }
@@ -68,51 +62,38 @@ public:
bool isEmpty() const { return m_value.isEmpty(); }
PassRefPtr<Attribute> clone() const;
-
- CSSMutableStyleDeclaration* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; }
-
- CSSMappedAttributeDeclaration* mappedAttributeDeclaration() const { return m_mappedAttributeDeclaration.get(); }
- void setMappedAttributeDeclaration(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_mappedAttributeDeclaration = decl; }
void setValue(const AtomicString& value) { m_value = value; }
void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); }
// Note: This API is only for HTMLTreeBuilder. It is not safe to change the
- // name of an attribute once parseMappedAttribute has been called as DOM
+ // name of an attribute once parseAttribute has been called as DOM
// elements may have placed the Attribute in a hash by name.
void parserSetName(const QualifiedName& name) { m_name = name; }
- bool isMappedAttribute() { return m_isMappedAttribute; }
-
private:
- Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl)
- : m_isMappedAttribute(isMappedAttribute)
- , m_hasAttr(false)
+ Attribute(const QualifiedName& name, const AtomicString& value)
+ : m_hasAttr(false)
, m_name(name)
, m_value(value)
- , m_mappedAttributeDeclaration(styleDecl)
{
}
- Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl)
- : m_isMappedAttribute(isMappedAttribute)
- , m_hasAttr(false)
+ Attribute(const AtomicString& name, const AtomicString& value)
+ : m_hasAttr(false)
, m_name(nullAtom, name, nullAtom)
, m_value(value)
- , m_mappedAttributeDeclaration(styleDecl)
{
}
void bindAttr(Attr*);
void unbindAttr(Attr*);
- // These booleans will go into the spare 32-bits of padding from RefCounted in 64-bit.
- bool m_isMappedAttribute;
+ // This boolean will go into the spare 32-bits of padding from RefCounted in 64-bit.
bool m_hasAttr;
QualifiedName m_name;
AtomicString m_value;
- RefPtr<CSSMappedAttributeDeclaration> m_mappedAttributeDeclaration;
};
} // namespace WebCore
diff --git a/Source/WebCore/dom/BeforeLoadEvent.idl b/Source/WebCore/dom/BeforeLoadEvent.idl
index 4600e8574..08dfbbb30 100644
--- a/Source/WebCore/dom/BeforeLoadEvent.idl
+++ b/Source/WebCore/dom/BeforeLoadEvent.idl
@@ -29,7 +29,7 @@ module events {
interface [
ConstructorTemplate=Event
] BeforeLoadEvent : Event {
- readonly attribute [InitializedByConstructor] DOMString url;
+ readonly attribute [InitializedByEventConstructor] DOMString url;
};
}
diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp b/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp
deleted file mode 100644
index 72e256a65..000000000
--- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2011 Apple Inc. 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
- * 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., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "config.h"
-#include "CSSMappedAttributeDeclaration.h"
-
-#include "CSSImageValue.h"
-#include "CSSParser.h"
-#include "CSSValuePool.h"
-#include "StyledElement.h"
-
-namespace WebCore {
-
-inline void CSSMappedAttributeDeclaration::setNeedsStyleRecalc(StyledElement* element)
-{
- ASSERT(element);
- element->setNeedsStyleRecalc(FullStyleChange);
-}
-
-CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration()
-{
- StyledElement::removeMappedAttributeDecl(m_entryType, m_attrName, m_attrValue);
-}
-
-void CSSMappedAttributeDeclaration::setMappedImageProperty(StyledElement* element, int propertyId, const String& url)
-{
- m_declaration->setProperty(CSSProperty(propertyId, CSSImageValue::create(url)));
- setNeedsStyleRecalc(element);
-}
-
-void CSSMappedAttributeDeclaration::setMappedLengthProperty(StyledElement* element, int propertyId, const String& value)
-{
- setMappedProperty(element, propertyId, value);
-}
-
-void CSSMappedAttributeDeclaration::setMappedProperty(StyledElement* element, int propertyId, int value)
-{
- ASSERT(element->document());
- m_declaration->setProperty(CSSProperty(propertyId, element->document()->cssValuePool()->createIdentifierValue(value)));
- setNeedsStyleRecalc(element);
-}
-
-void CSSMappedAttributeDeclaration::setMappedProperty(StyledElement* element, int propertyId, const String& value)
-{
- if (value.isEmpty()) {
- removeMappedProperty(element, propertyId);
- return;
- }
-
- if (!CSSParser::parseMappedAttributeValue(this, element, propertyId, value))
- return;
-
- setNeedsStyleRecalc(element);
-}
-
-void CSSMappedAttributeDeclaration::removeMappedProperty(StyledElement* element, int propertyId)
-{
- m_declaration->removeProperty(propertyId, false, false);
- setNeedsStyleRecalc(element);
-}
-
-}
diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h b/Source/WebCore/dom/CSSMappedAttributeDeclaration.h
deleted file mode 100644
index d9544ed5e..000000000
--- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2011 Apple Inc. 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
- * 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., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef CSSMappedAttributeDeclaration_h
-#define CSSMappedAttributeDeclaration_h
-
-#include "CSSMutableStyleDeclaration.h"
-#include "MappedAttributeEntry.h"
-#include "QualifiedName.h"
-
-namespace WebCore {
-
-class StyledElement;
-
-class CSSMappedAttributeDeclaration : public RefCounted<CSSMappedAttributeDeclaration> {
-public:
- static PassRefPtr<CSSMappedAttributeDeclaration> create()
- {
- return adoptRef(new CSSMappedAttributeDeclaration);
- }
-
- ~CSSMappedAttributeDeclaration();
-
- void setMappedState(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& val)
- {
- m_entryType = type;
- m_attrName = name;
- m_attrValue = val;
- }
-
- void setMappedProperty(StyledElement*, int propertyId, int value);
- void setMappedProperty(StyledElement*, int propertyId, const String& value);
- void setMappedImageProperty(StyledElement*, int propertyId, const String& url);
-
- // NOTE: setMappedLengthProperty() treats integers as pixels! (Needed for conversion of HTML attributes.)
- void setMappedLengthProperty(StyledElement*, int propertyId, const String& value);
-
- void removeMappedProperty(StyledElement*, int propertyId);
-
- CSSMutableStyleDeclaration* declaration() const { return m_declaration.get(); }
-
-private:
- CSSMappedAttributeDeclaration()
- : m_declaration(CSSMutableStyleDeclaration::create())
- , m_entryType(eNone)
- , m_attrName(anyQName())
- {
- }
-
- void setNeedsStyleRecalc(StyledElement*);
-
- RefPtr<CSSMutableStyleDeclaration> m_declaration;
- MappedAttributeEntry m_entryType;
- QualifiedName m_attrName;
- AtomicString m_attrValue;
-};
-
-} //namespace
-
-#endif
diff --git a/Source/WebCore/dom/CharacterData.idl b/Source/WebCore/dom/CharacterData.idl
index aeeae2f99..dcf796ae5 100644
--- a/Source/WebCore/dom/CharacterData.idl
+++ b/Source/WebCore/dom/CharacterData.idl
@@ -21,27 +21,27 @@ module core {
interface CharacterData : Node {
- attribute [TreatNullAs=EmptyString] DOMString data
+ attribute [TreatNullAs=NullString] DOMString data
setter raises(DOMException);
readonly attribute unsigned long length;
- [ConvertNullStringTo=Null, OldStyleObjC] DOMString substringData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
+ [ConvertNullStringTo=Null, ObjCLegacyUnnamedParameters] DOMString substringData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
in [IsIndex,Optional=CallWithDefaultValue] unsigned long length)
raises(DOMException);
void appendData(in [Optional=CallWithDefaultValue] DOMString data)
raises(DOMException);
- [OldStyleObjC] void insertData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
+ [ObjCLegacyUnnamedParameters] void insertData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
in [Optional=CallWithDefaultValue] DOMString data)
raises(DOMException);
- [OldStyleObjC] void deleteData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
+ [ObjCLegacyUnnamedParameters] void deleteData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
in [IsIndex,Optional=CallWithDefaultValue] unsigned long length)
raises(DOMException);
- [OldStyleObjC] void replaceData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
+ [ObjCLegacyUnnamedParameters] void replaceData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset,
in [IsIndex,Optional=CallWithDefaultValue] unsigned long length,
in [Optional=CallWithDefaultValue] DOMString data)
raises(DOMException);
diff --git a/Source/WebCore/dom/ClientRectList.idl b/Source/WebCore/dom/ClientRectList.idl
index ee4629c30..45d6f485f 100644
--- a/Source/WebCore/dom/ClientRectList.idl
+++ b/Source/WebCore/dom/ClientRectList.idl
@@ -27,7 +27,7 @@
module view {
interface [
- HasIndexGetter
+ IndexedGetter
] ClientRectList {
readonly attribute unsigned long length;
ClientRect item(in [IsIndex,Optional=CallWithDefaultValue] unsigned long index);
diff --git a/Source/WebCore/dom/Clipboard.h b/Source/WebCore/dom/Clipboard.h
index f94727a0e..a07ae9fc5 100644
--- a/Source/WebCore/dom/Clipboard.h
+++ b/Source/WebCore/dom/Clipboard.h
@@ -69,13 +69,13 @@ namespace WebCore {
virtual HashSet<String> types() const = 0;
virtual PassRefPtr<FileList> files() const = 0;
- LayoutPoint dragLocation() const { return m_dragLoc; }
+ IntPoint dragLocation() const { return m_dragLoc; }
CachedImage* dragImage() const { return m_dragImage.get(); }
- virtual void setDragImage(CachedImage*, const LayoutPoint&) = 0;
+ virtual void setDragImage(CachedImage*, const IntPoint&) = 0;
Node* dragImageElement() const { return m_dragImageElement.get(); }
- virtual void setDragImageElement(Node*, const LayoutPoint&) = 0;
+ virtual void setDragImageElement(Node*, const IntPoint&) = 0;
- virtual DragImageRef createDragImage(LayoutPoint& dragLocation) const = 0;
+ virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
#if ENABLE(DRAG_SUPPORT)
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
#endif
@@ -117,7 +117,7 @@ namespace WebCore {
ClipboardType m_clipboardType;
protected:
- LayoutPoint m_dragLoc;
+ IntPoint m_dragLoc;
CachedResourceHandle<CachedImage> m_dragImage;
RefPtr<Node> m_dragImageElement;
};
diff --git a/Source/WebCore/dom/Clipboard.idl b/Source/WebCore/dom/Clipboard.idl
index 95456076b..dc453f298 100644
--- a/Source/WebCore/dom/Clipboard.idl
+++ b/Source/WebCore/dom/Clipboard.idl
@@ -42,7 +42,7 @@ module core {
[Custom] void setDragImage(in HTMLImageElement image, in long x, in long y)
raises(DOMException);
- readonly attribute [Conditional=DATA_TRANSFER_ITEMS, EnabledAtRuntime=DataTransferItems] DataTransferItemList items;
+ readonly attribute [Conditional=DATA_TRANSFER_ITEMS, V8EnabledAtRuntime=DataTransferItems] DataTransferItemList items;
};
}
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp
index c385636cf..dbd2b7259 100644
--- a/Source/WebCore/dom/ContainerNode.cpp
+++ b/Source/WebCore/dom/ContainerNode.cpp
@@ -115,6 +115,8 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce
// If it is, it can be deleted as a side effect of sending mutation events.
ASSERT(refCount() || parentOrHostNode());
+ RefPtr<Node> protect(this);
+
ec = 0;
// insertBefore(node, 0) is equivalent to appendChild(node)
@@ -260,6 +262,8 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce
// If it is, it can be deleted as a side effect of sending mutation events.
ASSERT(refCount() || parentOrHostNode());
+ RefPtr<Node> protect(this);
+
ec = 0;
if (oldChild == newChild) // nothing to do
@@ -426,6 +430,8 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
// If it is, it can be deleted as a side effect of sending mutation events.
ASSERT(refCount() || parentOrHostNode());
+ RefPtr<Node> protect(this);
+
ec = 0;
// NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
@@ -604,6 +610,8 @@ void ContainerNode::removeChildren()
bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bool shouldLazyAttach)
{
+ RefPtr<ContainerNode> protect(this);
+
// Check that this node is not "floating".
// If it is, it can be deleted as a side effect of sending mutation events.
ASSERT(refCount() || parentOrHostNode());
diff --git a/Source/WebCore/dom/CustomEvent.idl b/Source/WebCore/dom/CustomEvent.idl
index 3be395527..53a1ffca8 100644
--- a/Source/WebCore/dom/CustomEvent.idl
+++ b/Source/WebCore/dom/CustomEvent.idl
@@ -30,7 +30,7 @@ module events {
interface [
ConstructorTemplate=Event
] CustomEvent : Event {
- readonly attribute [InitializedByConstructor] DOMObject detail;
+ readonly attribute [InitializedByEventConstructor] DOMObject detail;
void initCustomEvent(in [Optional=CallWithDefaultValue] DOMString typeArg,
in [Optional=CallWithDefaultValue] boolean canBubbleArg,
diff --git a/Source/WebCore/dom/DOMAllInOne.cpp b/Source/WebCore/dom/DOMAllInOne.cpp
index 50422d5ac..8b1ebbb88 100644
--- a/Source/WebCore/dom/DOMAllInOne.cpp
+++ b/Source/WebCore/dom/DOMAllInOne.cpp
@@ -31,7 +31,6 @@
#include "BeforeTextInsertedEvent.cpp"
#include "BeforeUnloadEvent.cpp"
#include "CDATASection.cpp"
-#include "CSSMappedAttributeDeclaration.cpp"
#include "CharacterData.cpp"
#include "CheckedRadioButtons.cpp"
#include "ChildNodeList.cpp"
diff --git a/Source/WebCore/dom/DOMCoreException.idl b/Source/WebCore/dom/DOMCoreException.idl
index dc5240bc2..3f25b021a 100644
--- a/Source/WebCore/dom/DOMCoreException.idl
+++ b/Source/WebCore/dom/DOMCoreException.idl
@@ -29,8 +29,8 @@
module core {
interface [
- NoStaticTables,
- DontCheckEnums
+ JSNoStaticTables,
+ DoNotCheckConstants
] DOMCoreException {
readonly attribute unsigned short code;
@@ -39,7 +39,7 @@ module core {
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
// Override in a Mozilla compatible format
- [DontEnum] DOMString toString();
+ [NotEnumerable] DOMString toString();
#endif
// ExceptionCode
diff --git a/Source/WebCore/dom/DOMImplementation.idl b/Source/WebCore/dom/DOMImplementation.idl
index 57577ecb5..0a2368e52 100644
--- a/Source/WebCore/dom/DOMImplementation.idl
+++ b/Source/WebCore/dom/DOMImplementation.idl
@@ -21,29 +21,29 @@
module core {
interface [
- GenerateIsReachable=ImplDocument,
+ JSGenerateIsReachable=ImplDocument,
V8DependentLifetime
] DOMImplementation {
// DOM Level 1
- [OldStyleObjC] boolean hasFeature(in [Optional=CallWithDefaultValue] DOMString feature,
- in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString version);
+ [ObjCLegacyUnnamedParameters] boolean hasFeature(in [Optional=CallWithDefaultValue] DOMString feature,
+ in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString version);
// DOM Level 2
- [OldStyleObjC] DocumentType createDocumentType(in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString qualifiedName,
- in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString publicId,
- in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString systemId)
+ [ObjCLegacyUnnamedParameters] DocumentType createDocumentType(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName,
+ in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString publicId,
+ in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString systemId)
raises(DOMException);
- [OldStyleObjC] Document createDocument(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
- in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString qualifiedName,
- in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DocumentType doctype)
+ [ObjCLegacyUnnamedParameters] Document createDocument(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName,
+ in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DocumentType doctype)
raises(DOMException);
// DOMImplementationCSS interface from DOM Level 2 CSS
- [OldStyleObjC] CSSStyleSheet createCSSStyleSheet(in [Optional=CallWithDefaultValue] DOMString title,
+ [ObjCLegacyUnnamedParameters] CSSStyleSheet createCSSStyleSheet(in [Optional=CallWithDefaultValue] DOMString title,
in [Optional=CallWithDefaultValue] DOMString media)
raises(DOMException);
diff --git a/Source/WebCore/dom/DOMStringList.idl b/Source/WebCore/dom/DOMStringList.idl
index 8b37aaaeb..8238575c6 100644
--- a/Source/WebCore/dom/DOMStringList.idl
+++ b/Source/WebCore/dom/DOMStringList.idl
@@ -26,7 +26,7 @@
module core {
interface [
- HasIndexGetter
+ IndexedGetter
] DOMStringList {
readonly attribute unsigned long length;
[ConvertNullStringTo=Null] DOMString item(in [IsIndex,Optional=CallWithDefaultValue] unsigned long index);
diff --git a/Source/WebCore/dom/DOMStringMap.idl b/Source/WebCore/dom/DOMStringMap.idl
index 3546518a8..dbda74dba 100644
--- a/Source/WebCore/dom/DOMStringMap.idl
+++ b/Source/WebCore/dom/DOMStringMap.idl
@@ -26,11 +26,11 @@
module core {
interface [
- GenerateIsReachable=ImplElementRoot,
- HasNameGetter,
+ JSGenerateIsReachable=ImplElementRoot,
+ NamedGetter,
CustomDeleteProperty,
CustomGetPropertyNames,
- DelegatingPutFunction,
+ CustomNamedSetter,
] DOMStringMap {
};
diff --git a/Source/WebCore/dom/DataTransferItemList.idl b/Source/WebCore/dom/DataTransferItemList.idl
index 4adff1ecf..8fcc47ded 100644
--- a/Source/WebCore/dom/DataTransferItemList.idl
+++ b/Source/WebCore/dom/DataTransferItemList.idl
@@ -32,8 +32,8 @@ module core {
interface [
Conditional=DATA_TRANSFER_ITEMS,
- HasIndexGetter,
- GenerateNativeConverter,
+ IndexedGetter,
+ JSGenerateToNativeObject,
#if defined(V8_BINDING) && V8_BINDING
CustomDeleteProperty,
#endif
diff --git a/Source/WebCore/dom/DatasetDOMStringMap.cpp b/Source/WebCore/dom/DatasetDOMStringMap.cpp
index dff0ad750..382022ecd 100644
--- a/Source/WebCore/dom/DatasetDOMStringMap.cpp
+++ b/Source/WebCore/dom/DatasetDOMStringMap.cpp
@@ -29,7 +29,6 @@
#include "Attribute.h"
#include "Element.h"
#include "ExceptionCode.h"
-#include "NamedNodeMap.h"
#include <wtf/ASCIICType.h>
#include <wtf/text/StringBuilder.h>
@@ -142,27 +141,27 @@ void DatasetDOMStringMap::deref()
void DatasetDOMStringMap::getNames(Vector<String>& names)
{
- NamedNodeMap* attributeMap = m_element->updatedAttributes();
- if (attributeMap) {
- unsigned length = attributeMap->length();
- for (unsigned i = 0; i < length; i++) {
- Attribute* attribute = attributeMap->attributeItem(i);
- if (isValidAttributeName(attribute->localName()))
- names.append(convertAttributeNameToPropertyName(attribute->localName()));
- }
+ if (!m_element->hasAttributes())
+ return;
+
+ unsigned length = m_element->attributeCount();
+ for (unsigned i = 0; i < length; i++) {
+ Attribute* attribute = m_element->attributeItem(i);
+ if (isValidAttributeName(attribute->localName()))
+ names.append(convertAttributeNameToPropertyName(attribute->localName()));
}
}
String DatasetDOMStringMap::item(const String& name)
{
- NamedNodeMap* attributeMap = m_element->updatedAttributes();
- if (attributeMap) {
- unsigned length = attributeMap->length();
- for (unsigned i = 0; i < length; i++) {
- Attribute* attribute = attributeMap->attributeItem(i);
- if (propertyNameMatchesAttributeName(name, attribute->localName()))
- return attribute->value();
- }
+ if (!m_element->hasAttributes())
+ return String();
+
+ unsigned length = m_element->attributeCount();
+ for (unsigned i = 0; i < length; i++) {
+ Attribute* attribute = m_element->attributeItem(i);
+ if (propertyNameMatchesAttributeName(name, attribute->localName()))
+ return attribute->value();
}
return String();
@@ -170,15 +169,16 @@ String DatasetDOMStringMap::item(const String& name)
bool DatasetDOMStringMap::contains(const String& name)
{
- NamedNodeMap* attributeMap = m_element->updatedAttributes();
- if (attributeMap) {
- unsigned length = attributeMap->length();
- for (unsigned i = 0; i < length; i++) {
- Attribute* attribute = attributeMap->attributeItem(i);
- if (propertyNameMatchesAttributeName(name, attribute->localName()))
- return true;
- }
+ if (!m_element->hasAttributes())
+ return false;
+
+ unsigned length = m_element->attributeCount();
+ for (unsigned i = 0; i < length; i++) {
+ Attribute* attribute = m_element->attributeItem(i);
+ if (propertyNameMatchesAttributeName(name, attribute->localName()))
+ return true;
}
+
return false;
}
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 3101e04e1..7e9293672 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -173,6 +173,7 @@
#include "SVGDocumentExtensions.h"
#include "SVGElementFactory.h"
#include "SVGNames.h"
+#include "SVGSVGElement.h"
#include "SVGStyleElement.h"
#endif
@@ -200,6 +201,10 @@
#include "NodeRareData.h"
#endif
+#if ENABLE(THREADED_SCROLLING)
+#include "ScrollingCoordinator.h"
+#endif
+
using namespace std;
using namespace WTF;
using namespace Unicode;
@@ -811,7 +816,7 @@ PassRefPtr<EditingText> Document::createEditingTextNode(const String& text)
PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()
{
- return CSSMutableStyleDeclaration::create();
+ return StylePropertySet::create()->ensureCSSStyleDeclaration();
}
PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode& ec)
@@ -850,15 +855,7 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCo
if (ec)
return 0;
- NamedNodeMap* attrs = oldElement->updatedAttributes();
- if (attrs) {
- unsigned length = attrs->length();
- for (unsigned i = 0; i < length; i++) {
- Attribute* attr = attrs->attributeItem(i);
- newElement->setAttribute(attr->name(), attr->value().impl());
- }
- }
-
+ newElement->setAttributesFromElement(*oldElement);
newElement->copyNonAttributeProperties(oldElement);
if (deep) {
@@ -1102,6 +1099,16 @@ void Document::setCharset(const String& charset)
decoder()->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
}
+void Document::setContentLanguage(const String& language)
+{
+ if (m_contentLanguage == language)
+ return;
+ m_contentLanguage = language;
+
+ // Recalculate style so language is used when selecting the initial font.
+ styleSelectorChanged(DeferRecalcStyle);
+}
+
void Document::setXMLVersion(const String& version, ExceptionCode& ec)
{
if (!implementation()->hasFeature("XML", String())) {
@@ -2251,6 +2258,15 @@ void Document::implicitClose()
ImageLoader::dispatchPendingBeforeLoadEvents();
ImageLoader::dispatchPendingLoadEvents();
+
+#if ENABLE(SVG)
+ // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from
+ // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
+ // which is the default, for ='true' its fired at a later time, once all external resources finished loading).
+ if (svgExtensions())
+ accessSVGExtensions()->dispatchSVGLoadEventToOutermostSVGElements();
+#endif
+
dispatchWindowLoadEvent();
enqueuePageshowEvent(PageshowEventNotPersisted);
enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
@@ -2320,9 +2336,6 @@ void Document::implicitClose()
#endif
#if ENABLE(SVG)
- // FIXME: Officially, time 0 is when the outermost <svg> receives its
- // SVGLoad event, but we don't implement those yet. This is close enough
- // for now. In some cases we should have fired earlier.
if (svgExtensions())
accessSVGExtensions()->startAnimations();
#endif
@@ -2788,11 +2801,13 @@ void Document::processViewport(const String& features)
m_viewportArguments = ViewportArguments(ViewportArguments::ViewportMeta);
processArguments(features, (void*)&m_viewportArguments, &setViewportFeature);
- Frame* frame = this->frame();
- if (!frame || !frame->page())
- return;
+ updateViewportArguments();
+}
- frame->page()->updateViewportArguments();
+void Document::updateViewportArguments()
+{
+ if (page() && page()->mainFrame() == frame())
+ page()->chrome()->dispatchViewportPropertiesDidChange(m_viewportArguments);
}
void Document::processReferrerPolicy(const String& policy)
@@ -4070,9 +4085,6 @@ void Document::setInPageCache(bool flag)
setRenderer(m_savedRenderer);
m_savedRenderer = 0;
- if (frame() && frame()->page())
- frame()->page()->updateViewportArguments();
-
if (childNeedsStyleRecalc())
scheduleStyleRecalc();
}
@@ -4113,6 +4125,8 @@ void Document::documentDidResumeFromPageCache()
ASSERT(m_frame);
m_frame->loader()->client()->dispatchDidBecomeFrameset(isFrameSet());
+
+ updateViewportArguments();
}
void Document::registerForPageCacheSuspensionCallbacks(Element* e)
@@ -4325,9 +4339,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S
return 0;
}
- // FIXME: Assume this is a mapped attribute, since createAttribute isn't namespace-aware. There's no harm to XML
- // documents if we're wrong.
- return Attr::create(0, this, Attribute::createMapped(qName, StringImpl::empty()));
+ return Attr::create(0, this, Attribute::create(qName, StringImpl::empty()));
}
#if ENABLE(SVG)
@@ -5352,12 +5364,35 @@ PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
}
#endif
+static void wheelEventHandlerCountChanged(Document* document)
+{
+#if ENABLE(THREADED_SCROLLING)
+ Page* page = document->page();
+ if (!page)
+ return;
+
+ ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator();
+ if (!scrollingCoordinator)
+ return;
+
+ FrameView* frameView = document->view();
+ if (!frameView)
+ return;
+
+ scrollingCoordinator->frameViewWheelEventHandlerCountChanged(frameView);
+#else
+ UNUSED_PARAM(document);
+#endif
+}
+
void Document::didAddWheelEventHandler()
{
++m_wheelEventHandlerCount;
Frame* mainFrame = page() ? page()->mainFrame() : 0;
if (mainFrame)
mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
+
+ wheelEventHandlerCountChanged(this);
}
void Document::didRemoveWheelEventHandler()
@@ -5367,6 +5402,8 @@ void Document::didRemoveWheelEventHandler()
Frame* mainFrame = page() ? page()->mainFrame() : 0;
if (mainFrame)
mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
+
+ wheelEventHandlerCountChanged(this);
}
bool Document::visualUpdatesAllowed() const
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index 2d160f128..a4bdad685 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -387,7 +387,7 @@ public:
String suggestedMIMEType() const;
String contentLanguage() const { return m_contentLanguage; }
- void setContentLanguage(const String& lang) { m_contentLanguage = lang; }
+ void setContentLanguage(const String&);
String xmlEncoding() const { return m_xmlEncoding; }
String xmlVersion() const { return m_xmlVersion; }
@@ -803,6 +803,7 @@ public:
*/
void processHttpEquiv(const String& equiv, const String& content);
void processViewport(const String& features);
+ void updateViewportArguments();
void processReferrerPolicy(const String& policy);
// Returns the owning element in the parent document.
diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl
index c04f850e1..de7b04df1 100644
--- a/Source/WebCore/dom/Document.idl
+++ b/Source/WebCore/dom/Document.idl
@@ -21,9 +21,9 @@
module core {
interface [
- CustomToJS,
- GenerateNativeConverter,
- InlineGetOwnPropertySlot
+ JSCustomToJS,
+ JSGenerateToNativeObject,
+ JSInlineGetOwnPropertySlot
] Document : Node {
// DOM Level 1 Core
@@ -31,34 +31,34 @@ module core {
readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
- [ReturnsNew] Element createElement(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString tagName)
+ [ReturnNewObject] Element createElement(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString tagName)
raises (DOMException);
DocumentFragment createDocumentFragment();
- [ReturnsNew] Text createTextNode(in [Optional=CallWithDefaultValue] DOMString data);
- [ReturnsNew] Comment createComment(in [Optional=CallWithDefaultValue] DOMString data);
- [ReturnsNew] CDATASection createCDATASection(in [Optional=CallWithDefaultValue] DOMString data)
+ [ReturnNewObject] Text createTextNode(in [Optional=CallWithDefaultValue] DOMString data);
+ [ReturnNewObject] Comment createComment(in [Optional=CallWithDefaultValue] DOMString data);
+ [ReturnNewObject] CDATASection createCDATASection(in [Optional=CallWithDefaultValue] DOMString data)
raises(DOMException);
- [OldStyleObjC, ReturnsNew] ProcessingInstruction createProcessingInstruction(in [Optional=CallWithDefaultValue] DOMString target,
+ [ObjCLegacyUnnamedParameters, ReturnNewObject] ProcessingInstruction createProcessingInstruction(in [Optional=CallWithDefaultValue] DOMString target,
in [Optional=CallWithDefaultValue] DOMString data)
raises (DOMException);
- [ReturnsNew] Attr createAttribute(in [Optional=CallWithDefaultValue] DOMString name)
+ [ReturnNewObject] Attr createAttribute(in [Optional=CallWithDefaultValue] DOMString name)
raises (DOMException);
- [ReturnsNew] EntityReference createEntityReference(in [Optional=CallWithDefaultValue] DOMString name)
+ [ReturnNewObject] EntityReference createEntityReference(in [Optional=CallWithDefaultValue] DOMString name)
raises(DOMException);
NodeList getElementsByTagName(in [Optional=CallWithDefaultValue] DOMString tagname);
// Introduced in DOM Level 2:
- [OldStyleObjC, ReturnsNew] Node importNode(in [Optional=CallWithDefaultValue] Node importedNode,
+ [ObjCLegacyUnnamedParameters, ReturnNewObject] Node importNode(in [Optional=CallWithDefaultValue] Node importedNode,
in [Optional] boolean deep)
raises (DOMException);
- [OldStyleObjC, ReturnsNew] Element createElementNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
- in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString qualifiedName)
+ [ObjCLegacyUnnamedParameters, ReturnNewObject] Element createElementNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName)
raises (DOMException);
- [OldStyleObjC, ReturnsNew] Attr createAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
- in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString qualifiedName)
+ [ObjCLegacyUnnamedParameters, ReturnNewObject] Attr createAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName)
raises (DOMException);
- [OldStyleObjC] NodeList getElementsByTagNameNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName);
Element getElementById(in [Optional=CallWithDefaultValue] DOMString elementId);
@@ -67,7 +67,7 @@ module core {
readonly attribute [ConvertNullStringTo=Null] DOMString inputEncoding;
readonly attribute [ConvertNullStringTo=Null] DOMString xmlEncoding;
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString xmlVersion
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString xmlVersion
setter raises (DOMException);
attribute boolean xmlStandalone
setter raises (DOMException);
@@ -75,7 +75,7 @@ module core {
Node adoptNode(in [Optional=CallWithDefaultValue] Node source)
raises (DOMException);
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString documentURI;
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString documentURI;
// DOM Level 2 Events (DocumentEvents interface)
@@ -88,12 +88,12 @@ module core {
// DOM Level 2 Tranversal and Range (DocumentTraversal interface)
- [OldStyleObjC] NodeIterator createNodeIterator(in [Optional=CallWithDefaultValue] Node root,
+ [ObjCLegacyUnnamedParameters] NodeIterator createNodeIterator(in [Optional=CallWithDefaultValue] Node root,
in [Optional=CallWithDefaultValue] unsigned long whatToShow,
in [Optional=CallWithDefaultValue] NodeFilter filter,
in [Optional=CallWithDefaultValue] boolean expandEntityReferences)
raises(DOMException);
- [OldStyleObjC] TreeWalker createTreeWalker(in [Optional=CallWithDefaultValue] Node root,
+ [ObjCLegacyUnnamedParameters] TreeWalker createTreeWalker(in [Optional=CallWithDefaultValue] Node root,
in [Optional=CallWithDefaultValue] unsigned long whatToShow,
in [Optional=CallWithDefaultValue] NodeFilter filter,
in [Optional=CallWithDefaultValue] boolean expandEntityReferences)
@@ -109,15 +109,15 @@ module core {
// DOM Level 2 Style (DocumentCSS interface)
- [OldStyleObjC] CSSStyleDeclaration getOverrideStyle(in [Optional=CallWithDefaultValue] Element element,
+ [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle(in [Optional=CallWithDefaultValue] Element element,
in [Optional=CallWithDefaultValue] DOMString pseudoElement);
// DOM Level 3 XPath (XPathEvaluator interface)
- [OldStyleObjC] XPathExpression createExpression(in [Optional=CallWithDefaultValue] DOMString expression,
+ [ObjCLegacyUnnamedParameters] XPathExpression createExpression(in [Optional=CallWithDefaultValue] DOMString expression,
in [Optional=CallWithDefaultValue] XPathNSResolver resolver)
raises(DOMException);
XPathNSResolver createNSResolver(in Node nodeResolver);
- [OldStyleObjC, V8Custom] XPathResult evaluate(in [Optional=CallWithDefaultValue] DOMString expression,
+ [ObjCLegacyUnnamedParameters, V8Custom] XPathResult evaluate(in [Optional=CallWithDefaultValue] DOMString expression,
in [Optional=CallWithDefaultValue] Node contextNode,
in [Optional=CallWithDefaultValue] XPathNSResolver resolver,
in [Optional=CallWithDefaultValue] unsigned short type,
@@ -128,7 +128,7 @@ module core {
boolean execCommand(in [Optional=CallWithDefaultValue] DOMString command,
in [Optional=CallWithDefaultValue] boolean userInterface,
- in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString value);
+ in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString value);
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
// FIXME: remove the these two versions once [Optional] is implemented for Objective-C.
@@ -145,17 +145,17 @@ module core {
// Moved down from HTMLDocument
- attribute [TreatNullAs=EmptyString] DOMString title;
+ attribute [TreatNullAs=NullString] DOMString title;
readonly attribute DOMString referrer;
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- attribute [TreatNullAs=EmptyString] DOMString domain
+ attribute [TreatNullAs=NullString] DOMString domain
setter raises (DOMException);
#else
readonly attribute DOMString domain;
#endif
readonly attribute DOMString URL;
- attribute [TreatNullAs=EmptyString] DOMString cookie
+ attribute [TreatNullAs=NullString] DOMString cookie
setter raises (DOMException),
getter raises (DOMException);
@@ -175,7 +175,7 @@ module core {
NodeList getElementsByName(in [Optional=CallWithDefaultValue] DOMString elementName);
#if defined(ENABLE_MICRODATA) && ENABLE_MICRODATA
- NodeList getItems(in [ConvertUndefinedOrNullToNullString, Optional=CallWithDefaultValue] DOMString typeNames);
+ NodeList getItems(in [TreatNullAs=NullString, TreatUndefinedAs=NullString, Optional=CallWithDefaultValue] DOMString typeNames);
#endif
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
@@ -184,7 +184,7 @@ module core {
// IE extensions
- attribute [ConvertNullStringTo=Undefined, TreatNullAs=EmptyString] DOMString charset;
+ attribute [ConvertNullStringTo=Undefined, TreatNullAs=NullString] DOMString charset;
readonly attribute [ConvertNullStringTo=Undefined] DOMString defaultCharset;
readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState;
@@ -202,7 +202,7 @@ module core {
// WebKit extensions
readonly attribute [ConvertNullStringTo=Null] DOMString preferredStylesheetSet;
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString selectedStylesheetSet;
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString selectedStylesheetSet;
#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT
CSSStyleDeclaration createCSSStyleDeclaration();
@@ -210,14 +210,14 @@ module core {
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
// DOM Level 2 Style Interface
- [OldStyleObjC, UsesView] CSSStyleDeclaration getComputedStyle(in Element element,
+ [ObjCLegacyUnnamedParameters, ObjCUseDefaultView] CSSStyleDeclaration getComputedStyle(in Element element,
in DOMString pseudoElement);
// WebKit extension
// FIXME: remove the first version once [Optional] is implemented for Objective-C.
- [UsesView] CSSRuleList getMatchedCSSRules(in Element element,
+ [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(in Element element,
in DOMString pseudoElement);
- [UsesView] CSSRuleList getMatchedCSSRules(in Element element,
+ [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(in Element element,
in DOMString pseudoElement,
in [Optional] boolean authorOnly);
@@ -241,91 +241,91 @@ module core {
raises(DOMException);
#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
- readonly attribute [EnabledAtRuntime] boolean webkitIsFullScreen;
- readonly attribute [EnabledAtRuntime] boolean webkitFullScreenKeyboardInputAllowed;
- readonly attribute [EnabledAtRuntime] Element webkitCurrentFullScreenElement;
- [EnabledAtRuntime] void webkitCancelFullScreen();
+ readonly attribute [V8EnabledAtRuntime] boolean webkitIsFullScreen;
+ readonly attribute [V8EnabledAtRuntime] boolean webkitFullScreenKeyboardInputAllowed;
+ readonly attribute [V8EnabledAtRuntime] Element webkitCurrentFullScreenElement;
+ [V8EnabledAtRuntime] void webkitCancelFullScreen();
#endif
WebKitNamedFlow webkitGetFlowByName(in DOMString name);
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
// Event handler DOM attributes
- attribute [DontEnum] EventListener onabort;
- attribute [DontEnum] EventListener onblur;
- attribute [DontEnum] EventListener onchange;
- attribute [DontEnum] EventListener onclick;
- attribute [DontEnum] EventListener oncontextmenu;
- attribute [DontEnum] EventListener ondblclick;
- attribute [DontEnum] EventListener ondrag;
- attribute [DontEnum] EventListener ondragend;
- attribute [DontEnum] EventListener ondragenter;
- attribute [DontEnum] EventListener ondragleave;
- attribute [DontEnum] EventListener ondragover;
- attribute [DontEnum] EventListener ondragstart;
- attribute [DontEnum] EventListener ondrop;
- attribute [DontEnum] EventListener onerror;
- attribute [DontEnum] EventListener onfocus;
- attribute [DontEnum] EventListener oninput;
- attribute [DontEnum] EventListener oninvalid;
- attribute [DontEnum] EventListener onkeydown;
- attribute [DontEnum] EventListener onkeypress;
- attribute [DontEnum] EventListener onkeyup;
- attribute [DontEnum] EventListener onload;
- attribute [DontEnum] EventListener onmousedown;
- attribute [DontEnum] EventListener onmousemove;
- attribute [DontEnum] EventListener onmouseout;
- attribute [DontEnum] EventListener onmouseover;
- attribute [DontEnum] EventListener onmouseup;
- attribute [DontEnum] EventListener onmousewheel;
- attribute [DontEnum] EventListener onreadystatechange;
- attribute [DontEnum] EventListener onscroll;
- attribute [DontEnum] EventListener onselect;
- attribute [DontEnum] EventListener onsubmit;
-
- // attribute [DontEnum] EventListener oncanplay;
- // attribute [DontEnum] EventListener oncanplaythrough;
- // attribute [DontEnum] EventListener ondurationchange;
- // attribute [DontEnum] EventListener onemptied;
- // attribute [DontEnum] EventListener onended;
- // attribute [DontEnum] EventListener onloadeddata;
- // attribute [DontEnum] EventListener onloadedmetadata;
- // attribute [DontEnum] EventListener onloadstart;
- // attribute [DontEnum] EventListener onpause;
- // attribute [DontEnum] EventListener onplay;
- // attribute [DontEnum] EventListener onplaying;
- // attribute [DontEnum] EventListener onprogress;
- // attribute [DontEnum] EventListener onratechange;
- // attribute [DontEnum] EventListener onseeked;
- // attribute [DontEnum] EventListener onseeking;
- // attribute [DontEnum] EventListener onshow;
- // attribute [DontEnum] EventListener onstalled;
- // attribute [DontEnum] EventListener onsuspend;
- // attribute [DontEnum] EventListener ontimeupdate;
- // attribute [DontEnum] EventListener onvolumechange;
- // attribute [DontEnum] EventListener onwaiting;
+ attribute [NotEnumerable] EventListener onabort;
+ attribute [NotEnumerable] EventListener onblur;
+ attribute [NotEnumerable] EventListener onchange;
+ attribute [NotEnumerable] EventListener onclick;
+ attribute [NotEnumerable] EventListener oncontextmenu;
+ attribute [NotEnumerable] EventListener ondblclick;
+ attribute [NotEnumerable] EventListener ondrag;
+ attribute [NotEnumerable] EventListener ondragend;
+ attribute [NotEnumerable] EventListener ondragenter;
+ attribute [NotEnumerable] EventListener ondragleave;
+ attribute [NotEnumerable] EventListener ondragover;
+ attribute [NotEnumerable] EventListener ondragstart;
+ attribute [NotEnumerable] EventListener ondrop;
+ attribute [NotEnumerable] EventListener onerror;
+ attribute [NotEnumerable] EventListener onfocus;
+ attribute [NotEnumerable] EventListener oninput;
+ attribute [NotEnumerable] EventListener oninvalid;
+ attribute [NotEnumerable] EventListener onkeydown;
+ attribute [NotEnumerable] EventListener onkeypress;
+ attribute [NotEnumerable] EventListener onkeyup;
+ attribute [NotEnumerable] EventListener onload;
+ attribute [NotEnumerable] EventListener onmousedown;
+ attribute [NotEnumerable] EventListener onmousemove;
+ attribute [NotEnumerable] EventListener onmouseout;
+ attribute [NotEnumerable] EventListener onmouseover;
+ attribute [NotEnumerable] EventListener onmouseup;
+ attribute [NotEnumerable] EventListener onmousewheel;
+ attribute [NotEnumerable] EventListener onreadystatechange;
+ attribute [NotEnumerable] EventListener onscroll;
+ attribute [NotEnumerable] EventListener onselect;
+ attribute [NotEnumerable] EventListener onsubmit;
+
+ // attribute [NotEnumerable] EventListener oncanplay;
+ // attribute [NotEnumerable] EventListener oncanplaythrough;
+ // attribute [NotEnumerable] EventListener ondurationchange;
+ // attribute [NotEnumerable] EventListener onemptied;
+ // attribute [NotEnumerable] EventListener onended;
+ // attribute [NotEnumerable] EventListener onloadeddata;
+ // attribute [NotEnumerable] EventListener onloadedmetadata;
+ // attribute [NotEnumerable] EventListener onloadstart;
+ // attribute [NotEnumerable] EventListener onpause;
+ // attribute [NotEnumerable] EventListener onplay;
+ // attribute [NotEnumerable] EventListener onplaying;
+ // attribute [NotEnumerable] EventListener onprogress;
+ // attribute [NotEnumerable] EventListener onratechange;
+ // attribute [NotEnumerable] EventListener onseeked;
+ // attribute [NotEnumerable] EventListener onseeking;
+ // attribute [NotEnumerable] EventListener onshow;
+ // attribute [NotEnumerable] EventListener onstalled;
+ // attribute [NotEnumerable] EventListener onsuspend;
+ // attribute [NotEnumerable] EventListener ontimeupdate;
+ // attribute [NotEnumerable] EventListener onvolumechange;
+ // attribute [NotEnumerable] EventListener onwaiting;
// WebKit extensions
- attribute [DontEnum] EventListener onbeforecut;
- attribute [DontEnum] EventListener oncut;
- attribute [DontEnum] EventListener onbeforecopy;
- attribute [DontEnum] EventListener oncopy;
- attribute [DontEnum] EventListener onbeforepaste;
- attribute [DontEnum] EventListener onpaste;
- attribute [DontEnum] EventListener onreset;
- attribute [DontEnum] EventListener onsearch;
- attribute [DontEnum] EventListener onselectstart;
- attribute [DontEnum] EventListener onselectionchange;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
- attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
- attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror;
+ attribute [NotEnumerable] EventListener onbeforecut;
+ attribute [NotEnumerable] EventListener oncut;
+ attribute [NotEnumerable] EventListener onbeforecopy;
+ attribute [NotEnumerable] EventListener oncopy;
+ attribute [NotEnumerable] EventListener onbeforepaste;
+ attribute [NotEnumerable] EventListener onpaste;
+ attribute [NotEnumerable] EventListener onreset;
+ attribute [NotEnumerable] EventListener onsearch;
+ attribute [NotEnumerable] EventListener onselectstart;
+ attribute [NotEnumerable] EventListener onselectionchange;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel;
+ attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
+ attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror;
#endif
#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
- [ReturnsNew, EnabledAtRuntime] Touch createTouch(in [Optional=CallWithDefaultValue] DOMWindow window,
+ [ReturnNewObject, V8EnabledAtRuntime] Touch createTouch(in [Optional=CallWithDefaultValue] DOMWindow window,
in [Optional=CallWithDefaultValue] EventTarget target,
in [Optional=CallWithDefaultValue] long identifier,
in [Optional=CallWithDefaultValue] long pageX,
@@ -337,7 +337,7 @@ module core {
in [Optional=CallWithDefaultValue] float webkitRotationAngle,
in [Optional=CallWithDefaultValue] float webkitForce)
raises (DOMException);
- [ReturnsNew, EnabledAtRuntime, Custom] TouchList createTouchList()
+ [ReturnNewObject, V8EnabledAtRuntime, Custom] TouchList createTouchList()
raises (DOMException);
#endif
diff --git a/Source/WebCore/dom/DocumentMarkerController.cpp b/Source/WebCore/dom/DocumentMarkerController.cpp
index b0eb1e162..c25023f2b 100644
--- a/Source/WebCore/dom/DocumentMarkerController.cpp
+++ b/Source/WebCore/dom/DocumentMarkerController.cpp
@@ -377,9 +377,9 @@ Vector<DocumentMarker*> DocumentMarkerController::markersInRange(Range* range, D
return foundMarkers;
}
-Vector<LayoutRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)
+Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)
{
- Vector<LayoutRect> result;
+ Vector<IntRect> result;
if (!possiblyHasMarkers(markerType))
return result;
diff --git a/Source/WebCore/dom/DocumentMarkerController.h b/Source/WebCore/dom/DocumentMarkerController.h
index 36c0d4323..e0672d0d3 100644
--- a/Source/WebCore/dom/DocumentMarkerController.h
+++ b/Source/WebCore/dom/DocumentMarkerController.h
@@ -72,7 +72,7 @@ public:
Vector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes);
Vector<DocumentMarker> markersForNode(Node*);
- Vector<LayoutRect> renderedRectsForMarkers(DocumentMarker::MarkerType);
+ Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType);
void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes);
#ifndef NDEBUG
diff --git a/Source/WebCore/dom/DocumentType.idl b/Source/WebCore/dom/DocumentType.idl
index 7992dc500..ed146fa4f 100644
--- a/Source/WebCore/dom/DocumentType.idl
+++ b/Source/WebCore/dom/DocumentType.idl
@@ -20,7 +20,7 @@
module core {
interface [
- GenerateNativeConverter
+ JSGenerateToNativeObject
] DocumentType : Node {
// DOM Level 1
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 5a2202126..355f38adb 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -566,10 +566,10 @@ PassRefPtr<ClientRect> Element::getBoundingClientRect()
return ClientRect::create(result);
}
-LayoutRect Element::screenRect() const
+IntRect Element::screenRect() const
{
if (!renderer())
- return LayoutRect();
+ return IntRect();
// FIXME: this should probably respect transforms
return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRectIgnoringTransforms());
}
@@ -655,10 +655,13 @@ PassRefPtr<Attribute> Element::createAttribute(const QualifiedName& name, const
return Attribute::create(name, value);
}
-void Element::attributeChanged(Attribute* attr, bool)
+void Element::attributeChanged(Attribute* attr)
{
if (isIdAttributeName(attr->name()))
idAttributeChanged(attr);
+ else if (attr->name() == HTMLNames::nameAttr)
+ setHasName(!attr->isNull());
+
recalcStyleIfNeededAfterAttributeChanged(attr);
updateAfterAttributeChanged(attr);
}
@@ -1196,10 +1199,7 @@ ShadowRoot* Element::ensureShadowRoot()
if (ShadowRoot* existingRoot = shadowRoot())
return existingRoot;
- ExceptionCode ec = 0;
- setShadowRoot(ShadowRoot::create(document()), ec);
- ASSERT(!ec);
- return shadowRoot();
+ return ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot).get();
}
void Element::removeShadowRoot()
@@ -1359,6 +1359,11 @@ void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* af
checkForEmptyStyleChange(this, renderStyle());
else
checkForSiblingStyleChanges(this, renderStyle(), false, beforeChange, afterChange, childCountDelta);
+
+ if (hasRareData()) {
+ if (ShadowRoot* root = shadowRoot())
+ root->hostChildrenChanged();
+ }
}
void Element::beginParsingChildren()
@@ -1735,22 +1740,6 @@ Element* Element::lastElementChild() const
return static_cast<Element*>(n);
}
-Element* Element::previousElementSibling() const
-{
- Node* n = previousSibling();
- while (n && !n->isElementNode())
- n = n->previousSibling();
- return static_cast<Element*>(n);
-}
-
-Element* Element::nextElementSibling() const
-{
- Node* n = nextSibling();
- while (n && !n->isElementNode())
- n = n->nextSibling();
- return static_cast<Element*>(n);
-}
-
unsigned Element::childElementCount() const
{
unsigned count = 0;
diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h
index 1d37eaec0..9381e2f58 100644
--- a/Source/WebCore/dom/Element.h
+++ b/Source/WebCore/dom/Element.h
@@ -130,6 +130,9 @@ public:
#endif
bool hasAttributes() const;
+ // This variant will not update the potentially invalid attributes. To be used when not interested
+ // in style attribute or one of the SVG animation attributes.
+ bool hasAttributesWithoutUpdate() const;
bool hasAttribute(const String& name) const;
bool hasAttributeNS(const String& namespaceURI, const String& localName) const;
@@ -149,6 +152,13 @@ public:
// so this function is not suitable for non-style uses.
const AtomicString& idForStyleResolution() const;
+ // Internal methods that assume the existence of attribute storage, one should use hasAttributes()
+ // before calling them.
+ size_t attributeCount() const;
+ Attribute* attributeItem(unsigned index) const;
+ Attribute* getAttributeItem(const QualifiedName&) const;
+ void removeAttribute(unsigned index);
+
void scrollIntoView(bool alignToTop = true);
void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
@@ -177,7 +187,7 @@ public:
PassRefPtr<ClientRect> getBoundingClientRect();
// Returns the absolute bounding box translated into screen coordinates:
- LayoutRect screenRect() const;
+ IntRect screenRect() const;
void removeAttribute(const String& name);
void removeAttributeNS(const String& namespaceURI, const String& localName);
@@ -221,7 +231,7 @@ public:
NamedNodeMap* updatedAttributes() const;
// This method is called whenever an attribute is added, changed or removed.
- virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+ virtual void attributeChanged(Attribute*);
// Only called by the parser immediately after element construction.
void parserSetAttributeMap(PassOwnPtr<NamedNodeMap>, FragmentScriptingPermission);
@@ -232,6 +242,9 @@ public:
ElementAttributeData* attributeData() const { return m_attributeMap ? m_attributeMap->attributeData() : 0; }
ElementAttributeData* ensureAttributeData() const { return ensureUpdatedAttributes()->attributeData(); }
+ // FIXME: This method should be removed once AttributeData is moved to Element.
+ ElementAttributeData* ensureAttributeDataWithoutUpdate() const { return ensureAttributeMap()->attributeData(); }
+
void setAttributesFromElement(const Element&);
virtual void copyNonAttributeProperties(const Element* source);
@@ -383,6 +396,8 @@ public:
PassRefPtr<RenderStyle> styleForRenderer();
+ PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
+
protected:
Element(const QualifiedName& tagName, Document* document, ConstructionType type)
: ContainerNode(document, type)
@@ -422,8 +437,7 @@ private:
virtual bool childTypeAllowed(NodeType) const;
void setAttributeInternal(size_t index, const QualifiedName&, const AtomicString& value);
- virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
-
+
#ifndef NDEBUG
virtual void formatForDebugger(char* buffer, unsigned length) const;
#endif
@@ -506,6 +520,22 @@ inline Element* Node::parentElement() const
return parent && parent->isElementNode() ? toElement(parent) : 0;
}
+inline Element* Element::previousElementSibling() const
+{
+ Node* n = previousSibling();
+ while (n && !n->isElementNode())
+ n = n->previousSibling();
+ return static_cast<Element*>(n);
+}
+
+inline Element* Element::nextElementSibling() const
+{
+ Node* n = nextSibling();
+ while (n && !n->isElementNode())
+ n = n->nextSibling();
+ return static_cast<Element*>(n);
+}
+
inline NamedNodeMap* Element::ensureUpdatedAttributes() const
{
updateInvalidAttributes();
@@ -576,6 +606,11 @@ inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name)
return nullAtom;
}
+inline bool Element::hasAttributesWithoutUpdate() const
+{
+ return m_attributeMap && !m_attributeMap->isEmpty();
+}
+
inline const AtomicString& Element::idForStyleResolution() const
{
ASSERT(hasID());
@@ -601,6 +636,30 @@ inline void Element::setIdAttribute(const AtomicString& value)
setAttribute(document()->idAttributeName(), value);
}
+inline size_t Element::attributeCount() const
+{
+ ASSERT(m_attributeMap);
+ return m_attributeMap->length();
+}
+
+inline Attribute* Element::attributeItem(unsigned index) const
+{
+ ASSERT(m_attributeMap);
+ return m_attributeMap->attributeItem(index);
+}
+
+inline Attribute* Element::getAttributeItem(const QualifiedName& name) const
+{
+ ASSERT(m_attributeMap);
+ return m_attributeMap->getAttributeItem(name);
+}
+
+inline void Element::removeAttribute(unsigned index)
+{
+ ASSERT(m_attributeMap);
+ m_attributeMap->removeAttribute(index);
+}
+
inline NamedNodeMap* Element::ensureAttributeMap() const
{
if (!m_attributeMap)
diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl
index eae90b29f..20d4c8e11 100644
--- a/Source/WebCore/dom/Element.idl
+++ b/Source/WebCore/dom/Element.idl
@@ -21,8 +21,8 @@
module core {
interface [
- GenerateNativeConverter,
- InlineGetOwnPropertySlot
+ JSGenerateToNativeObject,
+ JSInlineGetOwnPropertySlot
] Element : Node {
// DOM Level 1 Core
@@ -30,7 +30,7 @@ module core {
readonly attribute [ConvertNullStringTo=Null] DOMString tagName;
[ConvertNullStringTo=Null] DOMString getAttribute(in [Optional=CallWithDefaultValue] DOMString name);
- [OldStyleObjC] void setAttribute(in [Optional=CallWithDefaultValue] DOMString name,
+ [ObjCLegacyUnnamedParameters] void setAttribute(in [Optional=CallWithDefaultValue] DOMString name,
in [Optional=CallWithDefaultValue] DOMString value)
raises(DOMException);
void removeAttribute(in [Optional=CallWithDefaultValue] DOMString name);
@@ -43,22 +43,22 @@ module core {
// DOM Level 2 Core
- [OldStyleObjC] DOMString getAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] DOMString getAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName);
- [OldStyleObjC] void setAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] void setAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString qualifiedName,
in [Optional=CallWithDefaultValue] DOMString value)
raises(DOMException);
- [OldStyleObjC] void removeAttributeNS(in [TreatNullAs=EmptyString] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] void removeAttributeNS(in [TreatNullAs=NullString] DOMString namespaceURI,
in DOMString localName);
- [OldStyleObjC] NodeList getElementsByTagNameNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName);
- [OldStyleObjC] Attr getAttributeNodeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName);
Attr setAttributeNodeNS(in [Optional=CallWithDefaultValue] Attr newAttr)
raises(DOMException);
boolean hasAttribute(in DOMString name);
- [OldStyleObjC] boolean hasAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] boolean hasAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName);
readonly attribute CSSStyleDeclaration style;
@@ -130,81 +130,81 @@ module core {
#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
const unsigned short ALLOW_KEYBOARD_INPUT = 1;
- [EnabledAtRuntime] void webkitRequestFullScreen(in [Optional=CallWithDefaultValue] unsigned short flags);
+ [V8EnabledAtRuntime] void webkitRequestFullScreen(in [Optional=CallWithDefaultValue] unsigned short flags);
#endif
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
// Event handler DOM attributes
- attribute [DontEnum] EventListener onabort;
- attribute [DontEnum] EventListener onblur;
- attribute [DontEnum] EventListener onchange;
- attribute [DontEnum] EventListener onclick;
- attribute [DontEnum] EventListener oncontextmenu;
- attribute [DontEnum] EventListener ondblclick;
- attribute [DontEnum] EventListener ondrag;
- attribute [DontEnum] EventListener ondragend;
- attribute [DontEnum] EventListener ondragenter;
- attribute [DontEnum] EventListener ondragleave;
- attribute [DontEnum] EventListener ondragover;
- attribute [DontEnum] EventListener ondragstart;
- attribute [DontEnum] EventListener ondrop;
- attribute [DontEnum] EventListener onerror;
- attribute [DontEnum] EventListener onfocus;
- attribute [DontEnum] EventListener oninput;
- attribute [DontEnum] EventListener oninvalid;
- attribute [DontEnum] EventListener onkeydown;
- attribute [DontEnum] EventListener onkeypress;
- attribute [DontEnum] EventListener onkeyup;
- attribute [DontEnum] EventListener onload;
- attribute [DontEnum] EventListener onmousedown;
- attribute [DontEnum] EventListener onmousemove;
- attribute [DontEnum] EventListener onmouseout;
- attribute [DontEnum] EventListener onmouseover;
- attribute [DontEnum] EventListener onmouseup;
- attribute [DontEnum] EventListener onmousewheel;
- attribute [DontEnum] EventListener onscroll;
- attribute [DontEnum] EventListener onselect;
- attribute [DontEnum] EventListener onsubmit;
-
- // attribute [DontEnum] EventListener oncanplay;
- // attribute [DontEnum] EventListener oncanplaythrough;
- // attribute [DontEnum] EventListener ondurationchange;
- // attribute [DontEnum] EventListener onemptied;
- // attribute [DontEnum] EventListener onended;
- // attribute [DontEnum] EventListener onloadeddata;
- // attribute [DontEnum] EventListener onloadedmetadata;
- // attribute [DontEnum] EventListener onloadstart;
- // attribute [DontEnum] EventListener onpause;
- // attribute [DontEnum] EventListener onplay;
- // attribute [DontEnum] EventListener onplaying;
- // attribute [DontEnum] EventListener onprogress;
- // attribute [DontEnum] EventListener onratechange;
- // attribute [DontEnum] EventListener onreadystatechange;
- // attribute [DontEnum] EventListener onseeked;
- // attribute [DontEnum] EventListener onseeking;
- // attribute [DontEnum] EventListener onshow;
- // attribute [DontEnum] EventListener onstalled;
- // attribute [DontEnum] EventListener onsuspend;
- // attribute [DontEnum] EventListener ontimeupdate;
- // attribute [DontEnum] EventListener onvolumechange;
- // attribute [DontEnum] EventListener onwaiting;
+ attribute [NotEnumerable] EventListener onabort;
+ attribute [NotEnumerable] EventListener onblur;
+ attribute [NotEnumerable] EventListener onchange;
+ attribute [NotEnumerable] EventListener onclick;
+ attribute [NotEnumerable] EventListener oncontextmenu;
+ attribute [NotEnumerable] EventListener ondblclick;
+ attribute [NotEnumerable] EventListener ondrag;
+ attribute [NotEnumerable] EventListener ondragend;
+ attribute [NotEnumerable] EventListener ondragenter;
+ attribute [NotEnumerable] EventListener ondragleave;
+ attribute [NotEnumerable] EventListener ondragover;
+ attribute [NotEnumerable] EventListener ondragstart;
+ attribute [NotEnumerable] EventListener ondrop;
+ attribute [NotEnumerable] EventListener onerror;
+ attribute [NotEnumerable] EventListener onfocus;
+ attribute [NotEnumerable] EventListener oninput;
+ attribute [NotEnumerable] EventListener oninvalid;
+ attribute [NotEnumerable] EventListener onkeydown;
+ attribute [NotEnumerable] EventListener onkeypress;
+ attribute [NotEnumerable] EventListener onkeyup;
+ attribute [NotEnumerable] EventListener onload;
+ attribute [NotEnumerable] EventListener onmousedown;
+ attribute [NotEnumerable] EventListener onmousemove;
+ attribute [NotEnumerable] EventListener onmouseout;
+ attribute [NotEnumerable] EventListener onmouseover;
+ attribute [NotEnumerable] EventListener onmouseup;
+ attribute [NotEnumerable] EventListener onmousewheel;
+ attribute [NotEnumerable] EventListener onscroll;
+ attribute [NotEnumerable] EventListener onselect;
+ attribute [NotEnumerable] EventListener onsubmit;
+
+ // attribute [NotEnumerable] EventListener oncanplay;
+ // attribute [NotEnumerable] EventListener oncanplaythrough;
+ // attribute [NotEnumerable] EventListener ondurationchange;
+ // attribute [NotEnumerable] EventListener onemptied;
+ // attribute [NotEnumerable] EventListener onended;
+ // attribute [NotEnumerable] EventListener onloadeddata;
+ // attribute [NotEnumerable] EventListener onloadedmetadata;
+ // attribute [NotEnumerable] EventListener onloadstart;
+ // attribute [NotEnumerable] EventListener onpause;
+ // attribute [NotEnumerable] EventListener onplay;
+ // attribute [NotEnumerable] EventListener onplaying;
+ // attribute [NotEnumerable] EventListener onprogress;
+ // attribute [NotEnumerable] EventListener onratechange;
+ // attribute [NotEnumerable] EventListener onreadystatechange;
+ // attribute [NotEnumerable] EventListener onseeked;
+ // attribute [NotEnumerable] EventListener onseeking;
+ // attribute [NotEnumerable] EventListener onshow;
+ // attribute [NotEnumerable] EventListener onstalled;
+ // attribute [NotEnumerable] EventListener onsuspend;
+ // attribute [NotEnumerable] EventListener ontimeupdate;
+ // attribute [NotEnumerable] EventListener onvolumechange;
+ // attribute [NotEnumerable] EventListener onwaiting;
// WebKit extensions
- attribute [DontEnum] EventListener onbeforecut;
- attribute [DontEnum] EventListener oncut;
- attribute [DontEnum] EventListener onbeforecopy;
- attribute [DontEnum] EventListener oncopy;
- attribute [DontEnum] EventListener onbeforepaste;
- attribute [DontEnum] EventListener onpaste;
- attribute [DontEnum] EventListener onreset;
- attribute [DontEnum] EventListener onsearch;
- attribute [DontEnum] EventListener onselectstart;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
- attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
- attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
- attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror;
+ attribute [NotEnumerable] EventListener onbeforecut;
+ attribute [NotEnumerable] EventListener oncut;
+ attribute [NotEnumerable] EventListener onbeforecopy;
+ attribute [NotEnumerable] EventListener oncopy;
+ attribute [NotEnumerable] EventListener onbeforepaste;
+ attribute [NotEnumerable] EventListener onpaste;
+ attribute [NotEnumerable] EventListener onreset;
+ attribute [NotEnumerable] EventListener onsearch;
+ attribute [NotEnumerable] EventListener onselectstart;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend;
+ attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel;
+ attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
+ attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror;
#endif
};
diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp
index 1283304bd..cea62f3cf 100644
--- a/Source/WebCore/dom/ElementAttributeData.cpp
+++ b/Source/WebCore/dom/ElementAttributeData.cpp
@@ -26,6 +26,8 @@
#include "config.h"
#include "ElementAttributeData.h"
+#include "StyledElement.h"
+
namespace WebCore {
void ElementAttributeData::setClass(const String& className, bool shouldFoldCase)
@@ -33,4 +35,29 @@ void ElementAttributeData::setClass(const String& className, bool shouldFoldCase
m_classNames.set(className, shouldFoldCase);
}
+StylePropertySet* ElementAttributeData::ensureInlineStyleDecl(Element* element)
+{
+ if (!m_inlineStyleDecl) {
+ ASSERT(element->isStyledElement());
+ m_inlineStyleDecl = StylePropertySet::createInline(static_cast<StyledElement*>(element));
+ m_inlineStyleDecl->setStrictParsing(element->isHTMLElement() && !element->document()->inQuirksMode());
+ }
+ return m_inlineStyleDecl.get();
+}
+
+void ElementAttributeData::destroyInlineStyleDecl()
+{
+ if (!m_inlineStyleDecl)
+ return;
+ m_inlineStyleDecl->clearParentElement();
+ m_inlineStyleDecl = 0;
+}
+
+StylePropertySet* ElementAttributeData::ensureAttributeStyle(StyledElement* element)
+{
+ if (!m_attributeStyle)
+ m_attributeStyle = StylePropertySet::createAttributeStyle(element);
+ return m_attributeStyle.get();
+}
+
}
diff --git a/Source/WebCore/dom/ElementAttributeData.h b/Source/WebCore/dom/ElementAttributeData.h
index 20116c62f..408065981 100644
--- a/Source/WebCore/dom/ElementAttributeData.h
+++ b/Source/WebCore/dom/ElementAttributeData.h
@@ -26,8 +26,8 @@
#ifndef ElementAttributeData_h
#define ElementAttributeData_h
-#include "CSSMutableStyleDeclaration.h"
#include "SpaceSplitString.h"
+#include "StylePropertySet.h"
namespace WebCore {
@@ -42,6 +42,13 @@ public:
const AtomicString& idForStyleResolution() const { return m_idForStyleResolution; }
void setIdForStyleResolution(const AtomicString& newId) { m_idForStyleResolution = newId; }
+ StylePropertySet* inlineStyleDecl() { return m_inlineStyleDecl.get(); }
+ StylePropertySet* ensureInlineStyleDecl(Element*);
+ void destroyInlineStyleDecl();
+
+ StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); }
+ StylePropertySet* ensureAttributeStyle(StyledElement*);
+
private:
friend class NamedNodeMap;
@@ -49,7 +56,8 @@ private:
{
}
- RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
+ RefPtr<StylePropertySet> m_inlineStyleDecl;
+ RefPtr<StylePropertySet> m_attributeStyle;
SpaceSplitString m_classNames;
AtomicString m_idForStyleResolution;
};
diff --git a/Source/WebCore/dom/ErrorEvent.idl b/Source/WebCore/dom/ErrorEvent.idl
index 6d3dc6c0c..2a0c2c514 100644
--- a/Source/WebCore/dom/ErrorEvent.idl
+++ b/Source/WebCore/dom/ErrorEvent.idl
@@ -31,12 +31,12 @@
module events {
interface [
- NoStaticTables,
+ JSNoStaticTables,
ConstructorTemplate=Event
] ErrorEvent : Event {
- readonly attribute [InitializedByConstructor] DOMString message;
- readonly attribute [InitializedByConstructor] DOMString filename;
- readonly attribute [InitializedByConstructor] unsigned long lineno;
+ readonly attribute [InitializedByEventConstructor] DOMString message;
+ readonly attribute [InitializedByEventConstructor] DOMString filename;
+ readonly attribute [InitializedByEventConstructor] unsigned long lineno;
};
}
diff --git a/Source/WebCore/dom/Event.idl b/Source/WebCore/dom/Event.idl
index 80b2f33cd..94d45427e 100644
--- a/Source/WebCore/dom/Event.idl
+++ b/Source/WebCore/dom/Event.idl
@@ -22,10 +22,10 @@ module events {
// Introduced in DOM Level 2:
interface [
- CustomToJS,
+ JSCustomToJS,
ConstructorTemplate=Event,
- NoStaticTables,
- Polymorphic
+ JSNoStaticTables,
+ ObjCPolymorphic
] Event {
// DOM PhaseType
@@ -57,13 +57,13 @@ module events {
readonly attribute EventTarget target;
readonly attribute EventTarget currentTarget;
readonly attribute unsigned short eventPhase;
- readonly attribute [InitializedByConstructor] boolean bubbles;
- readonly attribute [InitializedByConstructor] boolean cancelable;
+ readonly attribute [InitializedByEventConstructor] boolean bubbles;
+ readonly attribute [InitializedByEventConstructor] boolean cancelable;
readonly attribute DOMTimeStamp timeStamp;
void stopPropagation();
void preventDefault();
- [OldStyleObjC] void initEvent(in [Optional=CallWithDefaultValue] DOMString eventTypeArg,
+ [ObjCLegacyUnnamedParameters] void initEvent(in [Optional=CallWithDefaultValue] DOMString eventTypeArg,
in [Optional=CallWithDefaultValue] boolean canBubbleArg,
in [Optional=CallWithDefaultValue] boolean cancelableArg);
diff --git a/Source/WebCore/dom/EventException.idl b/Source/WebCore/dom/EventException.idl
index 3a9929ca9..28bcf9130 100644
--- a/Source/WebCore/dom/EventException.idl
+++ b/Source/WebCore/dom/EventException.idl
@@ -30,8 +30,8 @@ module events {
// Introduced in DOM Level 2:
interface [
- NoStaticTables,
- DontCheckEnums
+ JSNoStaticTables,
+ DoNotCheckConstants
] EventException {
readonly attribute unsigned short code;
@@ -40,7 +40,7 @@ module events {
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
// Override in a Mozilla compatible format
- [DontEnum] DOMString toString();
+ [NotEnumerable] DOMString toString();
#endif
// EventExceptionCode
diff --git a/Source/WebCore/dom/EventFactory.in b/Source/WebCore/dom/EventFactory.in
index 322da888b..1b500cd79 100644
--- a/Source/WebCore/dom/EventFactory.in
+++ b/Source/WebCore/dom/EventFactory.in
@@ -37,9 +37,8 @@ SVGEvents interfaceName=Event, conditional=SVG
SVGZoomEvent conditional=SVG
SVGZoomEvents interfaceName=SVGZoomEvent, conditional=SVG
IDBVersionChangeEvent conditional=INDEXED_DATABASE
-TouchEvent conditional=TOUCH_EVENTS
+TouchEvent conditional=TOUCH_EVENTS, runtimeConditional=touchEnabled
DeviceMotionEvent conditional=DEVICE_ORIENTATION
DeviceOrientationEvent conditional=DEVICE_ORIENTATION
OrientationEvent interfaceName=Event, conditional=ORIENTATION_EVENTS
TrackEvent conditional=VIDEO_TRACK
-
diff --git a/Source/WebCore/dom/EventListener.idl b/Source/WebCore/dom/EventListener.idl
index 023777bf3..4e83b440c 100644
--- a/Source/WebCore/dom/EventListener.idl
+++ b/Source/WebCore/dom/EventListener.idl
@@ -22,9 +22,9 @@ module events {
// Introduced in DOM Level 2:
interface [
- NoStaticTables,
+ JSNoStaticTables,
ObjCProtocol,
- PureInterface,
+ CPPPureInterface,
OmitConstructor
] EventListener {
void handleEvent(in Event evt);
diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h
index 6464d8c10..a616f7476 100644
--- a/Source/WebCore/dom/EventNames.h
+++ b/Source/WebCore/dom/EventNames.h
@@ -194,6 +194,7 @@ namespace WebCore {
macro(connecting) \
macro(addstream) \
macro(removestream) \
+ macro(statechange) \
\
macro(show) \
\
diff --git a/Source/WebCore/dom/EventTarget.idl b/Source/WebCore/dom/EventTarget.idl
index 8c683da1e..f1b0ef023 100644
--- a/Source/WebCore/dom/EventTarget.idl
+++ b/Source/WebCore/dom/EventTarget.idl
@@ -23,13 +23,13 @@ module events {
// Introduced in DOM Level 2:
interface [
ObjCProtocol,
- PureInterface,
+ CPPPureInterface,
OmitConstructor
] EventTarget {
- [OldStyleObjC] void addEventListener(in DOMString type,
+ [ObjCLegacyUnnamedParameters] void addEventListener(in DOMString type,
in EventListener listener,
in [Optional] boolean useCapture);
- [OldStyleObjC] void removeEventListener(in DOMString type,
+ [ObjCLegacyUnnamedParameters] void removeEventListener(in DOMString type,
in EventListener listener,
in [Optional] boolean useCapture);
boolean dispatchEvent(in Event event)
diff --git a/Source/WebCore/dom/ExceptionCodePlaceholder.cpp b/Source/WebCore/dom/ExceptionCodePlaceholder.cpp
index 7728c8b0d..71750254d 100644
--- a/Source/WebCore/dom/ExceptionCodePlaceholder.cpp
+++ b/Source/WebCore/dom/ExceptionCodePlaceholder.cpp
@@ -36,7 +36,7 @@ namespace WebCore {
#if !ASSERT_DISABLED
NoExceptionAssertionChecker::NoExceptionAssertionChecker(const char* file, int line)
- : ExceptionCodePlaceholder(0)
+ : ExceptionCodePlaceholder(defaultExceptionCode)
, m_file(file)
, m_line(line)
{
@@ -44,7 +44,7 @@ NoExceptionAssertionChecker::NoExceptionAssertionChecker(const char* file, int l
NoExceptionAssertionChecker::~NoExceptionAssertionChecker()
{
- ASSERT_AT(!m_code, m_file, m_line, "");
+ ASSERT_AT(!m_code || m_code == defaultExceptionCode, m_file, m_line, "");
}
#endif
diff --git a/Source/WebCore/dom/ExceptionCodePlaceholder.h b/Source/WebCore/dom/ExceptionCodePlaceholder.h
index 17dd7a0b6..cec8b8d52 100644
--- a/Source/WebCore/dom/ExceptionCodePlaceholder.h
+++ b/Source/WebCore/dom/ExceptionCodePlaceholder.h
@@ -70,6 +70,7 @@ public:
~NoExceptionAssertionChecker();
private:
+ static const ExceptionCode defaultExceptionCode = 0xaaaaaaaa;
const char* m_file;
int m_line;
};
diff --git a/Source/WebCore/dom/HashChangeEvent.idl b/Source/WebCore/dom/HashChangeEvent.idl
index 561b60686..b2b48877b 100644
--- a/Source/WebCore/dom/HashChangeEvent.idl
+++ b/Source/WebCore/dom/HashChangeEvent.idl
@@ -28,8 +28,8 @@ module events {
in [Optional=CallWithDefaultValue] boolean cancelable,
in [Optional=CallWithDefaultValue] DOMString oldURL,
in [Optional=CallWithDefaultValue] DOMString newURL);
- readonly attribute [InitializedByConstructor] DOMString oldURL;
- readonly attribute [InitializedByConstructor] DOMString newURL;
+ readonly attribute [InitializedByEventConstructor] DOMString oldURL;
+ readonly attribute [InitializedByEventConstructor] DOMString newURL;
};
}
diff --git a/Source/WebCore/dom/MappedAttributeEntry.h b/Source/WebCore/dom/MappedAttributeEntry.h
deleted file mode 100644
index 4de4927a5..000000000
--- a/Source/WebCore/dom/MappedAttributeEntry.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Peter Kelly (pmk@post.com)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
- * Copyright (C) 2010 Franois Sausset (sausset@gmail.com). 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
- * 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., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MappedAttributeEntry_h
-#define MappedAttributeEntry_h
-
-namespace WebCore {
-
-enum MappedAttributeEntry {
- eNone
- , eUniversal
- , eReplaced
- , eBlock
- , eHR
- , eUnorderedList
- , eListItem
- , eTable
- , eCell
- , eCaption
- , eBDI
- , eBDO
- , ePre
-#if ENABLE(SVG)
- , eSVG
-#endif
-#if ENABLE(MATHML)
- , eMathML
-#endif
-// When adding new entries, make sure to keep eLastEntry at the end of the list.
- , eLastEntry
-};
-
-}
-
-#endif
diff --git a/Source/WebCore/dom/MessageChannel.idl b/Source/WebCore/dom/MessageChannel.idl
index 4fc2bf89c..d21eb1142 100644
--- a/Source/WebCore/dom/MessageChannel.idl
+++ b/Source/WebCore/dom/MessageChannel.idl
@@ -30,8 +30,8 @@ module events {
Constructor,
CallWith=ScriptExecutionContext,
V8CustomConstructor,
- CustomMarkFunction,
- NoStaticTables
+ JSCustomMarkFunction,
+ JSNoStaticTables
] MessageChannel {
readonly attribute MessagePort port1;
diff --git a/Source/WebCore/dom/MessageEvent.idl b/Source/WebCore/dom/MessageEvent.idl
index 6d324f791..123235929 100644
--- a/Source/WebCore/dom/MessageEvent.idl
+++ b/Source/WebCore/dom/MessageEvent.idl
@@ -28,15 +28,15 @@
module events {
interface [
- NoStaticTables,
+ JSNoStaticTables,
ConstructorTemplate=Event
] MessageEvent : Event {
- readonly attribute [InitializedByConstructor] DOMString origin;
- readonly attribute [InitializedByConstructor] DOMString lastEventId;
- readonly attribute [InitializedByConstructor] DOMWindow source;
+ readonly attribute [InitializedByEventConstructor] DOMString origin;
+ readonly attribute [InitializedByEventConstructor] DOMString lastEventId;
+ readonly attribute [InitializedByEventConstructor] DOMWindow source;
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- readonly attribute [InitializedByConstructor, CachedAttribute, CustomGetter] DOMObject data;
- readonly attribute [InitializedByConstructor, CustomGetter] Array ports;
+ readonly attribute [InitializedByEventConstructor, CachedAttribute, CustomGetter] DOMObject data;
+ readonly attribute [InitializedByEventConstructor, CustomGetter] Array ports;
[Custom] void initMessageEvent(in [Optional=CallWithDefaultValue] DOMString typeArg,
in [Optional=CallWithDefaultValue] boolean canBubbleArg,
diff --git a/Source/WebCore/dom/MessagePort.idl b/Source/WebCore/dom/MessagePort.idl
index b26f32097..f318f7987 100644
--- a/Source/WebCore/dom/MessagePort.idl
+++ b/Source/WebCore/dom/MessagePort.idl
@@ -28,11 +28,11 @@
module events {
interface [
- CustomMarkFunction,
- GenerateIsReachable=Impl,
+ JSCustomMarkFunction,
+ JSGenerateIsReachable=Impl,
ActiveDOMObject,
EventTarget,
- NoStaticTables
+ JSNoStaticTables
] MessagePort {
// We need to have something as an ObjC binding, because MessagePort is used in MessageEvent, which already has one,
// but we don't want to actually expose the API while it is in flux.
diff --git a/Source/WebCore/dom/MouseEvent.idl b/Source/WebCore/dom/MouseEvent.idl
index d6b5f3500..3ece01c50 100644
--- a/Source/WebCore/dom/MouseEvent.idl
+++ b/Source/WebCore/dom/MouseEvent.idl
@@ -25,8 +25,8 @@ module events {
readonly attribute long screenY;
readonly attribute long clientX;
readonly attribute long clientY;
- readonly attribute [Conditional=POINTER_LOCK, EnabledAtRuntime] long webkitMovementX;
- readonly attribute [Conditional=POINTER_LOCK, EnabledAtRuntime] long webkitMovementY;
+ readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime] long webkitMovementX;
+ readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime] long webkitMovementY;
readonly attribute boolean ctrlKey;
readonly attribute boolean shiftKey;
readonly attribute boolean altKey;
@@ -34,7 +34,7 @@ module events {
readonly attribute unsigned short button;
readonly attribute EventTarget relatedTarget;
- [OldStyleObjC] void initMouseEvent(in [Optional=CallWithDefaultValue] DOMString type,
+ [ObjCLegacyUnnamedParameters] void initMouseEvent(in [Optional=CallWithDefaultValue] DOMString type,
in [Optional=CallWithDefaultValue] boolean canBubble,
in [Optional=CallWithDefaultValue] boolean cancelable,
in [Optional=CallWithDefaultValue] DOMWindow view,
diff --git a/Source/WebCore/dom/MutationEvent.idl b/Source/WebCore/dom/MutationEvent.idl
index b07cdd785..5aee2e560 100644
--- a/Source/WebCore/dom/MutationEvent.idl
+++ b/Source/WebCore/dom/MutationEvent.idl
@@ -33,7 +33,7 @@ module events {
readonly attribute DOMString attrName;
readonly attribute unsigned short attrChange;
- [OldStyleObjC] void initMutationEvent(in [Optional=CallWithDefaultValue] DOMString type,
+ [ObjCLegacyUnnamedParameters] void initMutationEvent(in [Optional=CallWithDefaultValue] DOMString type,
in [Optional=CallWithDefaultValue] boolean canBubble,
in [Optional=CallWithDefaultValue] boolean cancelable,
in [Optional=CallWithDefaultValue] Node relatedNode,
diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp
index 7f6229775..0a32a66ca 100644
--- a/Source/WebCore/dom/NamedNodeMap.cpp
+++ b/Source/WebCore/dom/NamedNodeMap.cpp
@@ -30,7 +30,6 @@
#include "Element.h"
#include "ExceptionCode.h"
#include "HTMLNames.h"
-#include "StyledElement.h"
namespace WebCore {
@@ -239,15 +238,12 @@ void NamedNodeMap::setAttributes(const NamedNodeMap& other)
clearAttributes();
unsigned newLength = other.length();
m_attributes.resize(newLength);
+
+ // FIXME: These loops can probably be combined.
for (unsigned i = 0; i < newLength; i++)
m_attributes[i] = other.m_attributes[i]->clone();
-
- // FIXME: This is wasteful. The class list could be preserved on a copy, and we
- // wouldn't have to waste time reparsing the attribute.
- // The derived class, HTMLNamedNodeMap, which manages a parsed class list for the CLASS attribute,
- // will update its member variable when parse attribute is called.
for (unsigned i = 0; i < newLength; i++)
- m_element->attributeChanged(m_attributes[i].get(), true);
+ m_element->attributeChanged(m_attributes[i].get());
}
void NamedNodeMap::addAttribute(PassRefPtr<Attribute> prpAttribute)
@@ -321,22 +317,4 @@ bool NamedNodeMap::mapsEquivalent(const NamedNodeMap* otherMap) const
return true;
}
-CSSMutableStyleDeclaration* NamedNodeMap::ensureInlineStyleDecl()
-{
- if (!attributeData()->m_inlineStyleDecl) {
- ASSERT(m_element->isStyledElement());
- attributeData()->m_inlineStyleDecl = CSSMutableStyleDeclaration::createInline(static_cast<StyledElement*>(m_element));
- attributeData()->m_inlineStyleDecl->setStrictParsing(m_element->isHTMLElement() && !m_element->document()->inQuirksMode());
- }
- return attributeData()->m_inlineStyleDecl.get();
-}
-
-void NamedNodeMap::destroyInlineStyleDecl()
-{
- if (!attributeData()->m_inlineStyleDecl)
- return;
- attributeData()->m_inlineStyleDecl->clearParentElement();
- attributeData()->m_inlineStyleDecl = 0;
-}
-
} // namespace WebCore
diff --git a/Source/WebCore/dom/NamedNodeMap.h b/Source/WebCore/dom/NamedNodeMap.h
index f53047c30..6bdde0fb3 100644
--- a/Source/WebCore/dom/NamedNodeMap.h
+++ b/Source/WebCore/dom/NamedNodeMap.h
@@ -94,15 +94,9 @@ public:
Element* element() const { return m_element; }
- size_t mappedAttributeCount() const;
-
ElementAttributeData* attributeData() { return &m_attributeData; }
const ElementAttributeData* attributeData() const { return &m_attributeData; }
- CSSMutableStyleDeclaration* inlineStyleDecl() { return attributeData()->m_inlineStyleDecl.get(); }
- CSSMutableStyleDeclaration* ensureInlineStyleDecl();
- void destroyInlineStyleDecl();
-
private:
NamedNodeMap(Element* element)
: m_element(element)
@@ -184,16 +178,6 @@ inline void NamedNodeMap::removeAttribute(const QualifiedName& name)
removeAttribute(index);
}
-inline size_t NamedNodeMap::mappedAttributeCount() const
-{
- size_t count = 0;
- for (size_t i = 0; i < m_attributes.size(); ++i) {
- if (m_attributes[i]->decl())
- ++count;
- }
- return count;
-}
-
} // namespace WebCore
#endif // NamedNodeMap_h
diff --git a/Source/WebCore/dom/NamedNodeMap.idl b/Source/WebCore/dom/NamedNodeMap.idl
index 016cac743..3c07a1146 100644
--- a/Source/WebCore/dom/NamedNodeMap.idl
+++ b/Source/WebCore/dom/NamedNodeMap.idl
@@ -21,10 +21,10 @@
module core {
interface [
- GenerateIsReachable=ImplElementRoot,
- CustomMarkFunction,
- HasIndexGetter,
- HasNameGetter
+ JSGenerateIsReachable=ImplElementRoot,
+ JSCustomMarkFunction,
+ IndexedGetter,
+ NamedGetter
] NamedNodeMap {
Node getNamedItem(in [Optional=CallWithDefaultValue] DOMString name);
@@ -42,7 +42,7 @@ module core {
// Introduced in DOM Level 2:
- [OldStyleObjC] Node getNamedItemNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] Node getNamedItemNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName)
// FIXME: the implementation does take an exceptioncode parameter.
/*raises(DOMException)*/;
@@ -50,7 +50,7 @@ module core {
Node setNamedItemNS(in [Optional=CallWithDefaultValue] Node node)
raises(DOMException);
- [OldStyleObjC] Node removeNamedItemNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ [ObjCLegacyUnnamedParameters] Node removeNamedItemNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName)
raises(DOMException);
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index 738000fec..39b8fa895 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -159,8 +159,6 @@ void Node::dumpStatistics()
HashMap<String, size_t> perTagCount;
size_t attributes = 0;
- size_t mappedAttributes = 0;
- size_t mappedAttributesWithStyleDecl = 0;
size_t attributesWithAttr = 0;
size_t attrMaps = 0;
@@ -188,11 +186,6 @@ void Node::dumpStatistics()
Attribute* attr = attrMap->attributeItem(i);
if (attr->attr())
++attributesWithAttr;
- if (attr->isMappedAttribute()) {
- ++mappedAttributes;
- if (attr->style())
- ++mappedAttributesWithStyleDecl;
- }
}
}
break;
@@ -277,8 +270,6 @@ void Node::dumpStatistics()
printf("Attribute Maps:\n");
printf(" Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes, sizeof(Attribute));
- printf(" Number of Attributes that are mapped: %zu\n", mappedAttributes);
- printf(" Number of Attributes with a StyleDeclaration: %zu\n", mappedAttributesWithStyleDecl);
printf(" Number of Attributes with an Attr: %zu\n", attributesWithAttr);
printf(" Number of NamedNodeMaps: %zu [%zu]\n", attrMaps, sizeof(NamedNodeMap));
#endif
@@ -641,7 +632,7 @@ void Node::normalize()
continue;
}
- Text* text = static_cast<Text*>(node.get());
+ RefPtr<Text> text = static_cast<Text*>(node.get());
// Remove empty text nodes.
if (!text->length()) {
@@ -1831,9 +1822,9 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const
if (elem->prefix().isNull())
return elem->namespaceURI() == namespaceURI;
- if (NamedNodeMap* attrs = elem->updatedAttributes()) {
- for (unsigned i = 0; i < attrs->length(); i++) {
- Attribute* attr = attrs->attributeItem(i);
+ if (elem->hasAttributes()) {
+ for (unsigned i = 0; i < elem->attributeCount(); i++) {
+ Attribute* attr = elem->attributeItem(i);
if (attr->localName() == xmlnsAtom)
return attr->value() == namespaceURI;
@@ -1917,9 +1908,9 @@ String Node::lookupNamespaceURI(const String &prefix) const
if (!elem->namespaceURI().isNull() && elem->prefix() == prefix)
return elem->namespaceURI();
- if (NamedNodeMap* attrs = elem->updatedAttributes()) {
- for (unsigned i = 0; i < attrs->length(); i++) {
- Attribute *attr = attrs->attributeItem(i);
+ if (elem->hasAttributes()) {
+ for (unsigned i = 0; i < elem->attributeCount(); i++) {
+ Attribute* attr = elem->attributeItem(i);
if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) {
if (!attr->value().isEmpty())
@@ -1971,9 +1962,11 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem
if (originalElement->lookupNamespaceURI(prefix()) == _namespaceURI)
return prefix();
- if (NamedNodeMap* attrs = toElement(this)->updatedAttributes()) {
- for (unsigned i = 0; i < attrs->length(); i++) {
- Attribute* attr = attrs->attributeItem(i);
+ ASSERT(isElementNode());
+ const Element* thisElement = toElement(this);
+ if (thisElement->hasAttributes()) {
+ for (unsigned i = 0; i < thisElement->attributeCount(); i++) {
+ Attribute* attr = thisElement->attributeItem(i);
if (attr->prefix() == xmlnsAtom && attr->value() == _namespaceURI
&& originalElement->lookupNamespaceURI(attr->localName()) == _namespaceURI)
@@ -2114,17 +2107,17 @@ unsigned short Node::compareDocumentPosition(Node* otherNode)
chain2.append(attr2);
if (attr1 && attr2 && start1 == start2 && start1) {
- // We are comparing two attributes on the same node. Crawl our attribute map
- // and see which one we hit first.
- NamedNodeMap* map = attr1->ownerElement()->updatedAttributes();
- unsigned length = map->length();
+ // We are comparing two attributes on the same node. Crawl our attribute map and see which one we hit first.
+ Element* owner1 = attr1->ownerElement();
+ owner1->updatedAttributes(); // Force update invalid attributes.
+ unsigned length = owner1->attributeCount();
for (unsigned i = 0; i < length; ++i) {
// If neither of the two determining nodes is a child node and nodeType is the same for both determining nodes, then an
// implementation-dependent order between the determining nodes is returned. This order is stable as long as no nodes of
// the same nodeType are inserted into or removed from the direct container. This would be the case, for example,
// when comparing two attributes of the same element, and inserting or removing additional attributes might change
// the order between existing attributes.
- Attribute* attr = map->attributeItem(i);
+ Attribute* attr = owner1->attributeItem(i);
if (attr1->attr() == attr)
return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING;
if (attr2->attr() == attr)
diff --git a/Source/WebCore/dom/Node.idl b/Source/WebCore/dom/Node.idl
index 6f3987d9f..b67be68b4 100644
--- a/Source/WebCore/dom/Node.idl
+++ b/Source/WebCore/dom/Node.idl
@@ -21,16 +21,16 @@
module core {
interface [
- CustomHeader,
- CustomMarkFunction,
- CustomPushEventHandlerScope,
- CustomIsReachable,
- CustomFinalize,
- CustomToJS,
+ JSCustomHeader,
+ JSCustomMarkFunction,
+ JSCustomPushEventHandlerScope,
+ JSCustomIsReachable,
+ JSCustomFinalize,
+ JSCustomToJS,
EventTarget,
- GenerateNativeConverter,
- InlineGetOwnPropertySlot,
- Polymorphic,
+ JSGenerateToNativeObject,
+ JSInlineGetOwnPropertySlot,
+ ObjCPolymorphic,
V8DependentLifetime
] Node
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
@@ -54,7 +54,7 @@ module core {
readonly attribute [ConvertNullStringTo=Null] DOMString nodeName;
// FIXME: the spec says this can also raise on retrieval.
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString nodeValue
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString nodeValue
setter raises(DOMException);
readonly attribute unsigned short nodeType;
@@ -67,10 +67,10 @@ module core {
readonly attribute NamedNodeMap attributes;
readonly attribute Document ownerDocument;
- [OldStyleObjC, Custom] Node insertBefore(in [Return] Node newChild,
+ [ObjCLegacyUnnamedParameters, Custom] Node insertBefore(in [Return] Node newChild,
in Node refChild)
raises(DOMException);
- [OldStyleObjC, Custom] Node replaceChild(in Node newChild,
+ [ObjCLegacyUnnamedParameters, Custom] Node replaceChild(in Node newChild,
in [Return] Node oldChild)
raises(DOMExceptionJSC);
[Custom] Node removeChild(in [Return] Node oldChild)
@@ -84,11 +84,11 @@ module core {
// Introduced in DOM Level 2:
- [OldStyleObjC] boolean isSupported(in [Optional=CallWithDefaultValue] DOMString feature,
- in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString version);
+ [ObjCLegacyUnnamedParameters] boolean isSupported(in [Optional=CallWithDefaultValue] DOMString feature,
+ in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString version);
readonly attribute [ConvertNullStringTo=Null] DOMString namespaceURI;
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString prefix
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString prefix
setter raises(DOMException);
readonly attribute [ConvertNullStringTo=Null] DOMString localName;
@@ -99,14 +99,14 @@ module core {
readonly attribute [ConvertNullStringTo=Null] DOMString baseURI;
// FIXME: the spec says this can also raise on retrieval.
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString textContent
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString textContent
setter raises(DOMException);
boolean isSameNode(in [Optional=CallWithDefaultValue] Node other);
boolean isEqualNode(in [Optional=CallWithDefaultValue] Node other);
- [ConvertNullStringTo=Null] DOMString lookupPrefix(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI);
- boolean isDefaultNamespace(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI);
- [ConvertNullStringTo=Null] DOMString lookupNamespaceURI(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString prefix);
+ [ConvertNullStringTo=Null] DOMString lookupPrefix(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI);
+ boolean isDefaultNamespace(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI);
+ [ConvertNullStringTo=Null] DOMString lookupNamespaceURI(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString prefix);
// DocumentPosition
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
diff --git a/Source/WebCore/dom/NodeFilter.idl b/Source/WebCore/dom/NodeFilter.idl
index 38dac10f0..8edef0e03 100644
--- a/Source/WebCore/dom/NodeFilter.idl
+++ b/Source/WebCore/dom/NodeFilter.idl
@@ -22,10 +22,10 @@ module traversal {
// Introduced in DOM Level 2:
interface [
- CustomMarkFunction,
- CustomNativeConverter,
+ JSCustomMarkFunction,
+ JSCustomToNativeObject,
ObjCProtocol,
- PureInterface
+ CPPPureInterface
] NodeFilter {
// Constants returned by acceptNode
const short FILTER_ACCEPT = 1;
diff --git a/Source/WebCore/dom/NodeIterator.idl b/Source/WebCore/dom/NodeIterator.idl
index 9f59ae1aa..5b3f288fb 100644
--- a/Source/WebCore/dom/NodeIterator.idl
+++ b/Source/WebCore/dom/NodeIterator.idl
@@ -22,7 +22,7 @@ module traversal {
// Introduced in DOM Level 2:
interface [
- CustomMarkFunction
+ JSCustomMarkFunction
] NodeIterator {
readonly attribute Node root;
readonly attribute unsigned long whatToShow;
diff --git a/Source/WebCore/dom/NodeList.idl b/Source/WebCore/dom/NodeList.idl
index a3102b128..ebe813f83 100644
--- a/Source/WebCore/dom/NodeList.idl
+++ b/Source/WebCore/dom/NodeList.idl
@@ -21,9 +21,9 @@
module core {
interface [
- CustomIsReachable,
- HasIndexGetter,
- HasNameGetter
+ JSCustomIsReachable,
+ IndexedGetter,
+ NamedGetter
] NodeList {
Node item(in [IsIndex,Optional=CallWithDefaultValue] unsigned long index);
diff --git a/Source/WebCore/dom/OverflowEvent.idl b/Source/WebCore/dom/OverflowEvent.idl
index b43b52cf6..a1ecc4179 100644
--- a/Source/WebCore/dom/OverflowEvent.idl
+++ b/Source/WebCore/dom/OverflowEvent.idl
@@ -32,9 +32,9 @@ module events {
const unsigned short VERTICAL = 1;
const unsigned short BOTH = 2;
- readonly attribute [InitializedByConstructor] unsigned short orient;
- readonly attribute [InitializedByConstructor] boolean horizontalOverflow;
- readonly attribute [InitializedByConstructor] boolean verticalOverflow;
+ readonly attribute [InitializedByEventConstructor] unsigned short orient;
+ readonly attribute [InitializedByEventConstructor] boolean horizontalOverflow;
+ readonly attribute [InitializedByEventConstructor] boolean verticalOverflow;
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
void initOverflowEvent(in [Optional=CallWithDefaultValue] unsigned short orient,
diff --git a/Source/WebCore/dom/PageTransitionEvent.idl b/Source/WebCore/dom/PageTransitionEvent.idl
index 3734dc655..76c8727b7 100644
--- a/Source/WebCore/dom/PageTransitionEvent.idl
+++ b/Source/WebCore/dom/PageTransitionEvent.idl
@@ -28,7 +28,7 @@ module events {
interface [
ConstructorTemplate=Event
] PageTransitionEvent : Event {
- readonly attribute [InitializedByConstructor] boolean persisted;
+ readonly attribute [InitializedByEventConstructor] boolean persisted;
};
}
diff --git a/Source/WebCore/dom/PopStateEvent.idl b/Source/WebCore/dom/PopStateEvent.idl
index 58ad95273..6326a9d7a 100644
--- a/Source/WebCore/dom/PopStateEvent.idl
+++ b/Source/WebCore/dom/PopStateEvent.idl
@@ -30,7 +30,7 @@ module events {
interface [
ConstructorTemplate=Event
] PopStateEvent : Event {
- readonly attribute [InitializedByConstructor, CustomGetter] DOMObject state;
+ readonly attribute [InitializedByEventConstructor, CustomGetter] DOMObject state;
};
#endif
diff --git a/Source/WebCore/dom/ProcessingInstruction.idl b/Source/WebCore/dom/ProcessingInstruction.idl
index 6f9f68dd4..9c673fdcb 100644
--- a/Source/WebCore/dom/ProcessingInstruction.idl
+++ b/Source/WebCore/dom/ProcessingInstruction.idl
@@ -25,7 +25,7 @@ module core {
// DOM Level 1
readonly attribute [ConvertNullStringTo=Null] DOMString target;
- attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString data
+ attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString data
setter raises(DOMException);
// interface LinkStyle from DOM Level 2 Style Sheets
diff --git a/Source/WebCore/dom/ProgressEvent.idl b/Source/WebCore/dom/ProgressEvent.idl
index 3bcdd3d79..f8d0b5baf 100644
--- a/Source/WebCore/dom/ProgressEvent.idl
+++ b/Source/WebCore/dom/ProgressEvent.idl
@@ -28,9 +28,9 @@ module events {
interface [
ConstructorTemplate=Event
] ProgressEvent : Event {
- readonly attribute [InitializedByConstructor] boolean lengthComputable;
- readonly attribute [InitializedByConstructor] unsigned long long loaded;
- readonly attribute [InitializedByConstructor] unsigned long long total;
+ readonly attribute [InitializedByEventConstructor] boolean lengthComputable;
+ readonly attribute [InitializedByEventConstructor] unsigned long long loaded;
+ readonly attribute [InitializedByEventConstructor] unsigned long long total;
};
}
diff --git a/Source/WebCore/dom/Range.idl b/Source/WebCore/dom/Range.idl
index 668fd5f13..eb7168fa6 100644
--- a/Source/WebCore/dom/Range.idl
+++ b/Source/WebCore/dom/Range.idl
@@ -36,10 +36,10 @@ module ranges {
readonly attribute Node commonAncestorContainer
getter raises(DOMException);
- [OldStyleObjC] void setStart(in [Optional=CallWithDefaultValue] Node refNode,
+ [ObjCLegacyUnnamedParameters] void setStart(in [Optional=CallWithDefaultValue] Node refNode,
in [Optional=CallWithDefaultValue] long offset)
raises(RangeException, DOMException);
- [OldStyleObjC] void setEnd(in [Optional=CallWithDefaultValue] Node refNode,
+ [ObjCLegacyUnnamedParameters] void setEnd(in [Optional=CallWithDefaultValue] Node refNode,
in [Optional=CallWithDefaultValue] long offset)
raises(RangeException, DOMException);
void setStartBefore(in [Optional=CallWithDefaultValue] Node refNode)
@@ -63,7 +63,7 @@ module ranges {
const unsigned short END_TO_END = 2;
const unsigned short END_TO_START = 3;
- [OldStyleObjC] short compareBoundaryPoints(in [Optional=CallWithDefaultValue] CompareHow how,
+ [ObjCLegacyUnnamedParameters] short compareBoundaryPoints(in [Optional=CallWithDefaultValue] CompareHow how,
in [Optional=CallWithDefaultValue] Range sourceRange)
raises(DOMException);
diff --git a/Source/WebCore/dom/RangeException.idl b/Source/WebCore/dom/RangeException.idl
index be05f961e..b2dfc6c5b 100644
--- a/Source/WebCore/dom/RangeException.idl
+++ b/Source/WebCore/dom/RangeException.idl
@@ -20,7 +20,7 @@
module ranges {
interface [
- DontCheckEnums
+ DoNotCheckConstants
] RangeException {
readonly attribute unsigned short code;
@@ -28,7 +28,7 @@ module ranges {
readonly attribute DOMString message;
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- [DontEnum] DOMString toString();
+ [NotEnumerable] DOMString toString();
#endif
// DOM Level 2
diff --git a/Source/WebCore/dom/ScriptExecutionContext.cpp b/Source/WebCore/dom/ScriptExecutionContext.cpp
index ef06c29ec..5670fe8ef 100644
--- a/Source/WebCore/dom/ScriptExecutionContext.cpp
+++ b/Source/WebCore/dom/ScriptExecutionContext.cpp
@@ -38,6 +38,7 @@
#include "EventTarget.h"
#include "FileThread.h"
#include "MessagePort.h"
+#include "PublicURLManager.h"
#include "ScriptCallStack.h"
#include "SecurityOrigin.h"
#include "Settings.h"
@@ -126,6 +127,10 @@ ScriptExecutionContext::~ScriptExecutionContext()
m_fileThread = 0;
}
#endif
+#if ENABLE(BLOB)
+ if (m_publicURLManager)
+ m_publicURLManager->contextDestroyed();
+#endif
}
#if ENABLE(SQL_DATABASE)
@@ -385,6 +390,15 @@ FileThread* ScriptExecutionContext::fileThread()
}
#endif
+#if ENABLE(BLOB)
+PublicURLManager& ScriptExecutionContext::publicURLManager()
+{
+ if (!m_publicURLManager)
+ m_publicURLManager = PublicURLManager::create();
+ return *m_publicURLManager;
+}
+#endif
+
void ScriptExecutionContext::adjustMinimumTimerInterval(double oldMinimumTimerInterval)
{
if (minimumTimerInterval() != oldMinimumTimerInterval) {
diff --git a/Source/WebCore/dom/ScriptExecutionContext.h b/Source/WebCore/dom/ScriptExecutionContext.h
index aed3411e0..6cbdd0265 100644
--- a/Source/WebCore/dom/ScriptExecutionContext.h
+++ b/Source/WebCore/dom/ScriptExecutionContext.h
@@ -53,6 +53,9 @@ class EventQueue;
class EventTarget;
class MessagePort;
+#if ENABLE(BLOB)
+class PublicURLManager;
+#endif
#if ENABLE(SQL_DATABASE)
class Database;
class DatabaseTaskSynchronizer;
@@ -103,6 +106,9 @@ public:
virtual void resumeActiveDOMObjects();
virtual void stopActiveDOMObjects();
+#if ENABLE(BLOB)
+ PublicURLManager& publicURLManager();
+#endif
void didCreateActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
void willDestroyActiveDOMObject(ActiveDOMObject*);
@@ -205,6 +211,9 @@ private:
bool m_inDispatchErrorEvent;
class PendingException;
OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions;
+#if ENABLE(BLOB)
+ OwnPtr<PublicURLManager> m_publicURLManager;
+#endif
#if ENABLE(SQL_DATABASE)
RefPtr<DatabaseThread> m_databaseThread;
diff --git a/Source/WebCore/dom/SelectorQuery.cpp b/Source/WebCore/dom/SelectorQuery.cpp
index a889f9f2b..ca6e3da21 100644
--- a/Source/WebCore/dom/SelectorQuery.cpp
+++ b/Source/WebCore/dom/SelectorQuery.cpp
@@ -98,14 +98,20 @@ bool SelectorDataList::canUseIdLookup(Node* rootNode) const
return true;
}
+static inline bool isTreeScopeRoot(Node* node)
+{
+ ASSERT(node);
+ return node->isDocumentNode() || node->isShadowRoot();
+}
+
template <bool firstMatchOnly>
void SelectorDataList::execute(const SelectorChecker& selectorChecker, Node* rootNode, Vector<RefPtr<Node> >& matchedElements) const
{
if (canUseIdLookup(rootNode)) {
ASSERT(m_selectors.size() == 1);
CSSSelector* selector = m_selectors[0].selector;
- Element* element = rootNode->document()->getElementById(selector->value());
- if (!element || !(rootNode->isDocumentNode() || element->isDescendantOf(rootNode)))
+ Element* element = rootNode->treeScope()->getElementById(selector->value());
+ if (!element || !(isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)))
return;
if (selectorChecker.checkSelector(m_selectors[0].selector, element, m_selectors[0].isFastCheckable))
matchedElements.append(element);
diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp
index 052c51d3e..290be3f6d 100644
--- a/Source/WebCore/dom/ShadowRoot.cpp
+++ b/Source/WebCore/dom/ShadowRoot.cpp
@@ -31,7 +31,9 @@
#include "Document.h"
#include "Element.h"
#include "HTMLContentElement.h"
+#include "HTMLNames.h"
#include "NodeRareData.h"
+#include "SVGNames.h"
#include "Text.h"
namespace WebCore {
@@ -59,16 +61,57 @@ ShadowRoot::~ShadowRoot()
clearRareData();
}
+static bool allowsAuthorShadowRoot(Element* element)
+{
+ // FIXME: MEDIA recreates shadow root dynamically.
+ // https://bugs.webkit.org/show_bug.cgi?id=77936
+ if (element->hasTagName(HTMLNames::videoTag) || element->hasTagName(HTMLNames::audioTag))
+ return false;
+
+ // FIXME: ValidationMessage recreates shadow root dynamically.
+ // https://bugs.webkit.org/show_bug.cgi?id=77937
+ // Especially, INPUT recreates shadow root dynamically.
+ // https://bugs.webkit.org/show_bug.cgi?id=77930
+ if (element->isFormControlElement())
+ return false;
+
+ // FIXME: We disable multiple shadow subtrees for SVG for while, because there will be problems to support it.
+ // https://bugs.webkit.org/show_bug.cgi?id=78205
+ // Especially SVG TREF recreates shadow root dynamically.
+ // https://bugs.webkit.org/show_bug.cgi?id=77938
+ if (element->isSVGElement())
+ return false;
+
+ return true;
+}
+
PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ExceptionCode& ec)
{
+ return create(element, CreatingAuthorShadowRoot, ec);
+}
+
+PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ShadowRootCreationPurpose purpose, ExceptionCode& ec)
+{
if (!element || element->shadowRoot()) {
ec = HIERARCHY_REQUEST_ERR;
return 0;
}
+
+ // Since some elements recreates shadow root dynamically, multiple shadow subtrees won't work well in that element.
+ // Until they are fixed, we disable adding author shadow root for them.
+ if (purpose == CreatingAuthorShadowRoot && !allowsAuthorShadowRoot(element)) {
+ ec = HIERARCHY_REQUEST_ERR;
+ return 0;
+ }
+
+ ASSERT(purpose != CreatingUserAgentShadowRoot || !element->shadowRoot());
RefPtr<ShadowRoot> shadowRoot = create(element->document());
+
+ ec = 0;
element->setShadowRoot(shadowRoot, ec);
if (ec)
return 0;
+
return shadowRoot.release();
}
@@ -142,8 +185,9 @@ void ShadowRoot::hostChildrenChanged()
{
if (!hasContentElement())
return;
+
// This results in forced detaching/attaching of the shadow render tree. See ShadowRoot::recalcStyle().
- setNeedsStyleRecalc();
+ setNeedsReattachHostChildrenAndShadow();
}
bool ShadowRoot::isInclusionSelectorActive() const
diff --git a/Source/WebCore/dom/ShadowRoot.h b/Source/WebCore/dom/ShadowRoot.h
index d0b189472..401ee5e9d 100644
--- a/Source/WebCore/dom/ShadowRoot.h
+++ b/Source/WebCore/dom/ShadowRoot.h
@@ -42,6 +42,16 @@ public:
static PassRefPtr<ShadowRoot> create(Document*);
static PassRefPtr<ShadowRoot> create(Element*, ExceptionCode&);
+ // FIXME: We will support multiple shadow subtrees, however current implementation does not work well
+ // if a shadow root is dynamically created. So we prohibit multiple shadow subtrees
+ // in several elements for a while.
+ // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs.
+ enum ShadowRootCreationPurpose {
+ CreatingUserAgentShadowRoot,
+ CreatingAuthorShadowRoot,
+ };
+ static PassRefPtr<ShadowRoot> create(Element*, ShadowRootCreationPurpose, ExceptionCode& = ASSERT_NO_EXCEPTION);
+
void recalcShadowTreeStyle(StyleChange);
void setNeedsReattachHostChildrenAndShadow();
diff --git a/Source/WebCore/dom/ShadowRoot.idl b/Source/WebCore/dom/ShadowRoot.idl
index ee6cc36c2..011d6795f 100644
--- a/Source/WebCore/dom/ShadowRoot.idl
+++ b/Source/WebCore/dom/ShadowRoot.idl
@@ -28,15 +28,15 @@ module core {
interface [
Conditional=SHADOW_DOM,
- EnabledAtRuntime=shadowDOM,
+ V8EnabledAtRuntime=shadowDOM,
Constructor(in Element host),
ConstructorRaisesException
- ] ShadowRoot : Node {
+ ] ShadowRoot : DocumentFragment {
readonly attribute Element host;
Element getElementById(in [Optional=CallWithDefaultValue] DOMString elementId);
NodeList getElementsByClassName(in [Optional=CallWithDefaultValue] DOMString className);
NodeList getElementsByTagName(in [Optional=CallWithDefaultValue] DOMString tagName);
- NodeList getElementsByTagNameNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI,
+ NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
in [Optional=CallWithDefaultValue] DOMString localName);
};
diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp
index 25f2cd807..526052647 100644
--- a/Source/WebCore/dom/StyledElement.cpp
+++ b/Source/WebCore/dom/StyledElement.cpp
@@ -25,10 +25,11 @@
#include "StyledElement.h"
#include "Attribute.h"
-#include "CSSMutableStyleDeclaration.h"
+#include "CSSImageValue.h"
#include "CSSStyleSelector.h"
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
+#include "CSSValuePool.h"
#include "Color.h"
#include "ClassList.h"
#include "ContentSecurityPolicy.h"
@@ -36,6 +37,7 @@
#include "Document.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
+#include "StylePropertySet.h"
#include <wtf/HashFunctions.h>
using namespace std;
@@ -44,75 +46,12 @@ namespace WebCore {
using namespace HTMLNames;
-struct MappedAttributeKey {
- uint16_t type;
- StringImpl* name;
- StringImpl* value;
- MappedAttributeKey(MappedAttributeEntry t = eNone, StringImpl* n = 0, StringImpl* v = 0)
- : type(t), name(n), value(v) { }
-};
-
-static inline bool operator==(const MappedAttributeKey& a, const MappedAttributeKey& b)
- { return a.type == b.type && a.name == b.name && a.value == b.value; }
-
-struct MappedAttributeKeyTraits : WTF::GenericHashTraits<MappedAttributeKey> {
- static const bool emptyValueIsZero = true;
- static const bool needsDestruction = false;
- static void constructDeletedValue(MappedAttributeKey& slot) { slot.type = eLastEntry; }
- static bool isDeletedValue(const MappedAttributeKey& value) { return value.type == eLastEntry; }
-};
-
-struct MappedAttributeHash {
- static unsigned hash(const MappedAttributeKey&);
- static bool equal(const MappedAttributeKey& a, const MappedAttributeKey& b) { return a == b; }
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-typedef HashMap<MappedAttributeKey, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits> MappedAttributeDecls;
-
-static MappedAttributeDecls* mappedAttributeDecls = 0;
-
-CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr)
-{
- if (!mappedAttributeDecls)
- return 0;
- return mappedAttributeDecls->get(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()));
-}
-
-CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value)
-{
- if (!mappedAttributeDecls)
- return 0;
- return mappedAttributeDecls->get(MappedAttributeKey(type, name.localName().impl(), value.impl()));
-}
-
-void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr, CSSMappedAttributeDeclaration* decl)
-{
- if (!mappedAttributeDecls)
- mappedAttributeDecls = new MappedAttributeDecls;
- mappedAttributeDecls->set(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()), decl);
-}
-
-void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl)
-{
- if (!mappedAttributeDecls)
- mappedAttributeDecls = new MappedAttributeDecls;
- mappedAttributeDecls->set(MappedAttributeKey(entryType, name.localName().impl(), value.impl()), decl);
-}
-
-void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& attrName, const AtomicString& attrValue)
-{
- if (!mappedAttributeDecls)
- return;
- mappedAttributeDecls->remove(MappedAttributeKey(entryType, attrName.localName().impl(), attrValue.impl()));
-}
-
void StyledElement::updateStyleAttribute() const
{
ASSERT(!isStyleAttributeValid());
setIsStyleAttributeValid();
setIsSynchronizingStyleAttribute();
- if (CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl())
+ if (StylePropertySet* inlineStyle = inlineStyleDecl())
const_cast<StyledElement*>(this)->setAttribute(styleAttr, inlineStyle->asText());
clearIsSynchronizingStyleAttribute();
}
@@ -122,70 +61,12 @@ StyledElement::~StyledElement()
destroyInlineStyleDecl();
}
-PassRefPtr<Attribute> StyledElement::createAttribute(const QualifiedName& name, const AtomicString& value)
-{
- return Attribute::createMapped(name, value);
-}
-
-void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void StyledElement::attributeChanged(Attribute* attr)
{
- if (attr->name() == HTMLNames::nameAttr)
- setHasName(!attr->isNull());
-
- if (!attr->isMappedAttribute()) {
- Element::attributeChanged(attr, preserveDecls);
- return;
- }
-
- if (attr->mappedAttributeDeclaration() && !preserveDecls) {
- attr->setMappedAttributeDeclaration(0);
- setNeedsStyleRecalc();
- }
+ if (!(attr->name() == styleAttr && isSynchronizingStyleAttribute()))
+ parseAttribute(attr);
- bool checkDecl = true;
- MappedAttributeEntry entry;
- bool needToParse = mapToEntry(attr->name(), entry);
- if (preserveDecls) {
- if (attr->mappedAttributeDeclaration()) {
- setNeedsStyleRecalc();
- checkDecl = false;
- }
- } else if (!attr->isNull() && entry != eNone) {
- CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(entry, attr);
- if (decl) {
- attr->setMappedAttributeDeclaration(decl);
- setNeedsStyleRecalc();
- checkDecl = false;
- } else
- needToParse = true;
- }
-
- // parseMappedAttribute() might create a CSSMappedAttributeDeclaration on the attribute.
- // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewDocument().
- // But currently we always clear its parent and node below when adding it to the decl table.
- // If that changes for some reason moving between documents will be buggy.
- // webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes.
- if (needToParse)
- parseMappedAttribute(attr);
-
- if (entry == eNone)
- recalcStyleIfNeededAfterAttributeChanged(attr);
-
- if (checkDecl && attr->mappedAttributeDeclaration()) {
- // Add the decl to the table in the appropriate spot.
- setMappedAttributeDecl(entry, attr, attr->mappedAttributeDeclaration());
- attr->mappedAttributeDeclaration()->setMappedState(entry, attr->name(), attr->value());
- }
-
- updateAfterAttributeChanged(attr);
-}
-
-bool StyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
-{
- result = eNone;
- if (attrName == styleAttr)
- return !isSynchronizingStyleAttribute();
- return true;
+ Element::attributeChanged(attr);
}
void StyledElement::classAttributeChanged(const AtomicString& newClassString)
@@ -210,11 +91,9 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString)
dispatchSubtreeModifiedEvent();
}
-void StyledElement::parseMappedAttribute(Attribute* attr)
+void StyledElement::parseAttribute(Attribute* attr)
{
- if (isIdAttributeName(attr->name()))
- idAttributeChanged(attr);
- else if (attr->name() == classAttr)
+ if (attr->name() == classAttr)
classAttributeChanged(attr->value());
else if (attr->name() == styleAttr) {
if (attr->isNull())
@@ -226,40 +105,60 @@ void StyledElement::parseMappedAttribute(Attribute* attr)
}
}
-void StyledElement::removeCSSProperty(Attribute* attribute, int id)
+void StyledElement::removeCSSProperties(int id1, int id2, int id3, int id4, int id5, int id6, int id7, int id8)
{
- if (!attribute->mappedAttributeDeclaration())
- createMappedDecl(attribute);
- attribute->mappedAttributeDeclaration()->removeMappedProperty(this, id);
+ StylePropertySet* style = attributeStyle();
+ if (!style)
+ return;
+
+ ASSERT(id1 != CSSPropertyInvalid);
+ style->removeProperty(id1);
+
+ if (id2 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id2);
+ if (id3 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id3);
+ if (id4 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id4);
+ if (id5 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id5);
+ if (id6 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id6);
+ if (id7 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id7);
+ if (id8 == CSSPropertyInvalid)
+ return;
+ style->removeProperty(id8);
}
-void StyledElement::addCSSProperty(Attribute* attribute, int id, const String &value)
+void StyledElement::addCSSProperty(int id, const String &value)
{
- if (!attribute->mappedAttributeDeclaration())
- createMappedDecl(attribute);
- attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, value);
+ if (!ensureAttributeStyle()->setProperty(id, value))
+ removeCSSProperty(id);
}
-void StyledElement::addCSSProperty(Attribute* attribute, int id, int value)
+void StyledElement::addCSSProperty(int propertyID, int identifier)
{
- if (!attribute->mappedAttributeDeclaration())
- createMappedDecl(attribute);
- attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, value);
+ ensureAttributeStyle()->setProperty(CSSProperty(propertyID, document()->cssValuePool()->createIdentifierValue(identifier)));
+ setNeedsStyleRecalc();
}
-void StyledElement::addCSSImageProperty(Attribute* attribute, int id, const String& url)
+void StyledElement::addCSSImageProperty(int id, const String& url)
{
- if (!attribute->mappedAttributeDeclaration())
- createMappedDecl(attribute);
- attribute->mappedAttributeDeclaration()->setMappedImageProperty(this, id, url);
+ ensureAttributeStyle()->setProperty(CSSProperty(id, CSSImageValue::create(url)));
+ setNeedsStyleRecalc();
}
-void StyledElement::addCSSLength(Attribute* attribute, int id, const String &value)
+void StyledElement::addCSSLength(int id, const String &value)
{
// FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
// length unit and make the appropriate parsed value.
- if (!attribute->mappedAttributeDeclaration())
- createMappedDecl(attribute);
// strip attribute garbage..
StringImpl* v = value.impl();
@@ -282,12 +181,12 @@ void StyledElement::addCSSLength(Attribute* attribute, int id, const String &val
}
if (l != v->length()) {
- attribute->mappedAttributeDeclaration()->setMappedLengthProperty(this, id, v->substring(0, l));
+ addCSSProperty(id, v->substring(0, l));
return;
}
}
- attribute->mappedAttributeDeclaration()->setMappedLengthProperty(this, id, value);
+ addCSSProperty(id, value);
}
static String parseColorStringWithCrazyLegacyRules(const String& colorString)
@@ -343,57 +242,30 @@ static String parseColorStringWithCrazyLegacyRules(const String& colorString)
}
// Color parsing that matches HTML's "rules for parsing a legacy color value"
-void StyledElement::addCSSColor(Attribute* attribute, int id, const String& attributeValue)
+void StyledElement::addCSSColor(int id, const String& attributeValue)
{
// An empty string doesn't apply a color. (One containing only whitespace does, which is why this check occurs before stripping.)
- if (attributeValue.isEmpty())
+ if (attributeValue.isEmpty()) {
+ removeCSSProperty(id);
return;
+ }
String colorString = attributeValue.stripWhiteSpace();
// "transparent" doesn't apply a color either.
- if (equalIgnoringCase(colorString, "transparent"))
+ if (equalIgnoringCase(colorString, "transparent")) {
+ removeCSSProperty(id);
return;
-
- if (!attribute->mappedAttributeDeclaration())
- createMappedDecl(attribute);
+ }
// If the string is a named CSS color or a 3/6-digit hex color, use that.
Color parsedColor(colorString);
if (parsedColor.isValid()) {
- attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, colorString);
+ addCSSProperty(id, colorString);
return;
}
- attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, parseColorStringWithCrazyLegacyRules(colorString));
-}
-
-void StyledElement::createMappedDecl(Attribute* attr)
-{
- RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create();
- attr->setMappedAttributeDeclaration(decl);
- ASSERT(!decl->declaration()->useStrictParsing());
-}
-
-unsigned MappedAttributeHash::hash(const MappedAttributeKey& key)
-{
- COMPILE_ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8, key_name_size);
- COMPILE_ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8, key_value_size);
-
- StringHasher hasher;
- const UChar* data;
-
- data = reinterpret_cast<const UChar*>(&key.name);
- hasher.addCharacters(data[0], data[1]);
- if (sizeof(key.name) == 8)
- hasher.addCharacters(data[2], data[3]);
-
- data = reinterpret_cast<const UChar*>(&key.value);
- hasher.addCharacters(data[0], data[1]);
- if (sizeof(key.value) == 8)
- hasher.addCharacters(data[2], data[3]);
-
- return hasher.hash();
+ addCSSProperty(id, parseColorStringWithCrazyLegacyRules(colorString));
}
void StyledElement::copyNonAttributeProperties(const Element* sourceElement)
@@ -405,7 +277,7 @@ void StyledElement::copyNonAttributeProperties(const Element* sourceElement)
if (!source->inlineStyleDecl())
return;
- CSSMutableStyleDeclaration* inlineStyle = ensureInlineStyleDecl();
+ StylePropertySet* inlineStyle = ensureInlineStyleDecl();
inlineStyle->copyPropertiesFrom(*source->inlineStyleDecl());
inlineStyle->setStrictParsing(source->inlineStyleDecl()->useStrictParsing());
@@ -417,7 +289,7 @@ void StyledElement::copyNonAttributeProperties(const Element* sourceElement)
void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
- if (CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl())
+ if (StylePropertySet* inlineStyle = inlineStyleDecl())
inlineStyle->addSubresourceStyleURLs(urls);
}
diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h
index d61f0afaf..2a6d392cf 100644
--- a/Source/WebCore/dom/StyledElement.h
+++ b/Source/WebCore/dom/StyledElement.h
@@ -25,48 +25,36 @@
#ifndef StyledElement_h
#define StyledElement_h
-#include "CSSMutableStyleDeclaration.h"
#include "Element.h"
-#include "MappedAttributeEntry.h"
+#include "StylePropertySet.h"
namespace WebCore {
class Attribute;
-class CSSMappedAttributeDeclaration;
class StyledElement : public Element {
public:
virtual ~StyledElement();
- size_t mappedAttributeCount() const { return attributeMap() ? attributeMap()->mappedAttributeCount() : 0; }
- bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; }
+ void addCSSLength(int id, const String& value);
+ void addCSSProperty(int id, const String& value);
+ void addCSSProperty(int id, int value);
+ void addCSSImageProperty(int propertyID, const String& url);
+ void addCSSColor(int id, const String& color);
+ void removeCSSProperties(int id1, int id2 = CSSPropertyInvalid, int id3 = CSSPropertyInvalid, int id4 = CSSPropertyInvalid, int id5 = CSSPropertyInvalid, int id6 = CSSPropertyInvalid, int id7 = CSSPropertyInvalid, int id8 = CSSPropertyInvalid);
+ void removeCSSProperty(int id) { removeCSSProperties(id); }
- void addCSSLength(Attribute*, int id, const String& value);
- void addCSSProperty(Attribute*, int id, const String& value);
- void addCSSProperty(Attribute*, int id, int value);
- void addCSSImageProperty(Attribute*, int propertyID, const String& url);
- void addCSSColor(Attribute*, int id, const String& color);
- void removeCSSProperty(Attribute*, int id);
-
- static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value);
- static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*);
- static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value);
-
- static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*);
- static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*);
-
- virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() { return 0; }
+ virtual StylePropertySet* additionalAttributeStyle() { return 0; }
void invalidateStyleAttribute();
- CSSMutableStyleDeclaration* inlineStyleDecl() const { return attributeMap() ? attributeMap()->inlineStyleDecl() : 0; }
- CSSMutableStyleDeclaration* ensureInlineStyleDecl() { return ensureAttributeMap()->ensureInlineStyleDecl(); }
- virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl(); }
+ StylePropertySet* inlineStyleDecl() const { return attributeData() ? attributeData()->inlineStyleDecl() : 0; }
+ StylePropertySet* ensureInlineStyleDecl() { return ensureAttributeDataWithoutUpdate()->ensureInlineStyleDecl(this); }
+ virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl()->ensureCSSStyleDeclaration(); }
- const SpaceSplitString& classNames() const;
+ StylePropertySet* attributeStyle() const { return attributeData() ? attributeData()->attributeStyle() : 0; }
+ StylePropertySet* ensureAttributeStyle() { return ensureAttributeDataWithoutUpdate()->ensureAttributeStyle(this); }
- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
-
- virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
+ const SpaceSplitString& classNames() const;
protected:
StyledElement(const QualifiedName& name, Document* document, ConstructionType type)
@@ -74,26 +62,24 @@ protected:
{
}
- virtual void attributeChanged(Attribute*, bool preserveDecls = false);
- virtual void parseMappedAttribute(Attribute*);
+ virtual void attributeChanged(Attribute*) OVERRIDE;
+ virtual void parseAttribute(Attribute*);
virtual void copyNonAttributeProperties(const Element*);
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
// classAttributeChanged() exists to share code between
- // parseMappedAttribute (called via setAttribute()) and
+ // parseAttribute (called via setAttribute()) and
// svgAttributeChanged (called when element.className.baseValue is set)
void classAttributeChanged(const AtomicString& newClassString);
private:
- void createMappedDecl(Attribute*);
-
virtual void updateStyleAttribute() const;
void destroyInlineStyleDecl()
{
- if (attributeMap())
- attributeMap()->destroyInlineStyleDecl();
+ if (attributeData())
+ attributeData()->destroyInlineStyleDecl();
}
};
diff --git a/Source/WebCore/dom/TouchList.idl b/Source/WebCore/dom/TouchList.idl
index ede7bf2e5..542325c78 100644
--- a/Source/WebCore/dom/TouchList.idl
+++ b/Source/WebCore/dom/TouchList.idl
@@ -27,7 +27,7 @@ module events {
interface [
Conditional=TOUCH_EVENTS,
- HasIndexGetter
+ IndexedGetter
] TouchList {
readonly attribute unsigned long length;
diff --git a/Source/WebCore/dom/TreeWalker.idl b/Source/WebCore/dom/TreeWalker.idl
index 890e3159a..d9ed36eab 100644
--- a/Source/WebCore/dom/TreeWalker.idl
+++ b/Source/WebCore/dom/TreeWalker.idl
@@ -22,7 +22,7 @@ module traversal {
// Introduced in DOM Level 2:
interface [
- CustomMarkFunction
+ JSCustomMarkFunction
] TreeWalker {
readonly attribute Node root;
readonly attribute unsigned long whatToShow;
diff --git a/Source/WebCore/dom/UIEvent.idl b/Source/WebCore/dom/UIEvent.idl
index 48b65298d..83dcdc95a 100644
--- a/Source/WebCore/dom/UIEvent.idl
+++ b/Source/WebCore/dom/UIEvent.idl
@@ -24,7 +24,7 @@ module events {
readonly attribute DOMWindow view;
readonly attribute long detail;
- [OldStyleObjC] void initUIEvent(in [Optional=CallWithDefaultValue] DOMString type,
+ [ObjCLegacyUnnamedParameters] void initUIEvent(in [Optional=CallWithDefaultValue] DOMString type,
in [Optional=CallWithDefaultValue] boolean canBubble,
in [Optional=CallWithDefaultValue] boolean cancelable,
in [Optional=CallWithDefaultValue] DOMWindow view,
diff --git a/Source/WebCore/dom/WebKitAnimationEvent.idl b/Source/WebCore/dom/WebKitAnimationEvent.idl
index fab8c095a..5e52250c3 100644
--- a/Source/WebCore/dom/WebKitAnimationEvent.idl
+++ b/Source/WebCore/dom/WebKitAnimationEvent.idl
@@ -28,8 +28,8 @@ module events {
interface [
ConstructorTemplate=Event
] WebKitAnimationEvent : Event {
- readonly attribute [InitializedByConstructor] DOMString animationName;
- readonly attribute [InitializedByConstructor] double elapsedTime;
+ readonly attribute [InitializedByEventConstructor] DOMString animationName;
+ readonly attribute [InitializedByEventConstructor] double elapsedTime;
};
}
diff --git a/Source/WebCore/dom/WebKitMutationObserver.cpp b/Source/WebCore/dom/WebKitMutationObserver.cpp
index a7eb1a174..60153627c 100644
--- a/Source/WebCore/dom/WebKitMutationObserver.cpp
+++ b/Source/WebCore/dom/WebKitMutationObserver.cpp
@@ -41,6 +41,7 @@
#include "MutationRecord.h"
#include "Node.h"
#include <wtf/ListHashSet.h>
+#include <wtf/MainThread.h>
namespace WebCore {
@@ -115,6 +116,7 @@ static MutationObserverSet& activeMutationObservers()
void WebKitMutationObserver::enqueueMutationRecord(PassRefPtr<MutationRecord> mutation)
{
+ ASSERT(isMainThread());
m_records.append(mutation);
activeMutationObservers().add(this);
}
@@ -132,6 +134,7 @@ void WebKitMutationObserver::deliver()
void WebKitMutationObserver::deliverAllMutations()
{
+ ASSERT(isMainThread());
static bool deliveryInProgress = false;
if (deliveryInProgress)
return;
diff --git a/Source/WebCore/dom/WebKitNamedFlow.idl b/Source/WebCore/dom/WebKitNamedFlow.idl
index 2eb9e7f26..06d85529e 100644
--- a/Source/WebCore/dom/WebKitNamedFlow.idl
+++ b/Source/WebCore/dom/WebKitNamedFlow.idl
@@ -29,7 +29,7 @@
module core {
interface [
- GenerateToJS
+ JSGenerateToJS
] WebKitNamedFlow {
};
}
diff --git a/Source/WebCore/dom/WebKitTransitionEvent.idl b/Source/WebCore/dom/WebKitTransitionEvent.idl
index 9f024d645..39903bdf2 100644
--- a/Source/WebCore/dom/WebKitTransitionEvent.idl
+++ b/Source/WebCore/dom/WebKitTransitionEvent.idl
@@ -28,8 +28,8 @@ module events {
interface [
ConstructorTemplate=Event
] WebKitTransitionEvent : Event {
- readonly attribute [InitializedByConstructor] DOMString propertyName;
- readonly attribute [InitializedByConstructor] double elapsedTime;
+ readonly attribute [InitializedByEventConstructor] DOMString propertyName;
+ readonly attribute [InitializedByEventConstructor] double elapsedTime;
};
}
diff --git a/Source/WebCore/dom/make_event_factory.pl b/Source/WebCore/dom/make_event_factory.pl
index db6a9343d..8ca45407d 100644
--- a/Source/WebCore/dom/make_event_factory.pl
+++ b/Source/WebCore/dom/make_event_factory.pl
@@ -42,7 +42,8 @@ sub defaultItemFactory
{
return (
'interfaceName' => 0,
- 'conditional' => 0
+ 'conditional' => 0,
+ 'runtimeConditional' => 0
);
}
@@ -85,6 +86,9 @@ sub generateImplementation()
print F "#include \"${namespace}Factory.h\"\n";
print F "\n";
print F "#include \"${namespace}Headers.h\"\n";
+ print F "#if USE(V8)\n";
+ print F "#include \"RuntimeEnabledFeatures.h\"\n";
+ print F "#endif\n";
print F "\n";
print F "namespace WebCore {\n";
print F "\n";
@@ -93,11 +97,20 @@ sub generateImplementation()
for my $eventName (sort keys %parsedEvents) {
my $conditional = $parsedEvents{$eventName}{"conditional"};
+ my $runtimeConditional = $parsedEvents{$eventName}{"runtimeConditional"};
my $interfaceName = $InCompiler->interfaceForItem($eventName);
print F "#if ENABLE($conditional)\n" if $conditional;
+ if ($runtimeConditional) {
+ print F " #if USE(V8)\n";
+ print F " // FIXME: JSC should support RuntimeEnabledFeatures as well.\n";
+ print F " if (type == \"$eventName\" && RuntimeEnabledFeatures::$runtimeConditional())\n";
+ print F " return ${interfaceName}::create();\n";
+ print F " #else\n";
+ }
print F " if (type == \"$eventName\")\n";
print F " return ${interfaceName}::create();\n";
+ print F "#endif // USE(V8)\n" if $runtimeConditional;
print F "#endif\n" if $conditional;
}