Merge from Chromium at DEPS revision r202854
This commit was generated by merge_to_master.py.
Change-Id: I5b225b76b2157384357897051ee5866dd4bb23a8
diff --git a/Source/core/dom/ActiveDOMObject.cpp b/Source/core/dom/ActiveDOMObject.cpp
index b15d2da..a3270fc 100644
--- a/Source/core/dom/ActiveDOMObject.cpp
+++ b/Source/core/dom/ActiveDOMObject.cpp
@@ -29,8 +29,6 @@
#include "core/dom/ScriptExecutionContext.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
-#include "core/workers/WorkerContext.h"
-#include "core/workers/WorkerThread.h"
namespace WebCore {
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 3aa4dab..5f99182 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -23,7 +23,6 @@
#include "config.h"
#include "core/dom/Attr.h"
-#include "HTMLNames.h"
#include "XMLNSNames.h"
#include "core/css/StylePropertySet.h"
#include "core/dom/ExceptionCode.h"
@@ -191,8 +190,8 @@
// This function only exists to support the Obj-C bindings.
if (!m_element || !m_element->isStyledElement())
return 0;
- m_style = StylePropertySet::create();
- static_cast<StyledElement*>(m_element)->collectStyleForPresentationAttribute(qualifiedName(), value(), static_cast<MutableStylePropertySet*>(m_style.get()));
+ m_style = MutableStylePropertySet::create();
+ static_cast<StyledElement*>(m_element)->collectStyleForPresentationAttribute(qualifiedName(), value(), m_style.get());
return m_style->ensureCSSStyleDeclaration();
}
diff --git a/Source/core/dom/Attr.h b/Source/core/dom/Attr.h
index 5ac819a..5bc6de2 100644
--- a/Source/core/dom/Attr.h
+++ b/Source/core/dom/Attr.h
@@ -31,7 +31,7 @@
namespace WebCore {
class CSSStyleDeclaration;
-class StylePropertySet;
+class MutableStylePropertySet;
// Attr can have Text children
// therefore it has to be a fullblown Node. The plan
@@ -73,9 +73,9 @@
virtual String nodeName() const OVERRIDE { return name(); }
virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; }
- const AtomicString& localName() const { return m_name.localName(); }
- const AtomicString& namespaceURI() const { return m_name.namespaceURI(); }
- const AtomicString& prefix() const { return m_name.prefix(); }
+ virtual const AtomicString& localName() const OVERRIDE { return m_name.localName(); }
+ virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.namespaceURI(); }
+ virtual const AtomicString& prefix() const OVERRIDE { return m_name.prefix(); }
virtual void setPrefix(const AtomicString&, ExceptionCode&);
@@ -88,10 +88,6 @@
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual const AtomicString& virtualPrefix() const { return prefix(); }
- virtual const AtomicString& virtualLocalName() const { return localName(); }
- virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
-
Attribute& elementAttribute();
// Attr wraps either an element/name, or a name/value pair (when it's a standalone Node.)
@@ -100,7 +96,7 @@
QualifiedName m_name;
AtomicString m_standaloneValue;
- RefPtr<StylePropertySet> m_style;
+ RefPtr<MutableStylePropertySet> m_style;
unsigned m_ignoreChildrenChanged : 31;
bool m_specified : 1;
};
diff --git a/Source/core/dom/CharacterData.cpp b/Source/core/dom/CharacterData.cpp
index 67a7e7e..6fb1d4e 100644
--- a/Source/core/dom/CharacterData.cpp
+++ b/Source/core/dom/CharacterData.cpp
@@ -77,8 +77,9 @@
// Some text break iterator implementations work best if the passed buffer is as small as possible,
// see <https://bugs.webkit.org/show_bug.cgi?id=29092>.
// We need at least two characters look-ahead to account for UTF-16 surrogates.
- if (characterLengthLimit < characterLength) {
- NonSharedCharacterBreakIterator it(string.characters() + offset, (characterLengthLimit + 2 > characterLength) ? characterLength : characterLengthLimit + 2);
+ ASSERT(!string.is8Bit() || string.containsOnlyLatin1()); // Latin-1 doesn't have unbreakable boundaries.
+ if (characterLengthLimit < characterLength && !string.is8Bit()) {
+ NonSharedCharacterBreakIterator it(string.characters16() + offset, (characterLengthLimit + 2 > characterLength) ? characterLength : characterLengthLimit + 2);
if (!isTextBreak(it, characterLengthLimit))
characterLengthLimit = textBreakPreceding(it, characterLengthLimit);
}
diff --git a/Source/core/dom/ChildListMutationScope.cpp b/Source/core/dom/ChildListMutationScope.cpp
index 190069f..835bed7 100644
--- a/Source/core/dom/ChildListMutationScope.cpp
+++ b/Source/core/dom/ChildListMutationScope.cpp
@@ -32,8 +32,6 @@
#include "core/dom/ChildListMutationScope.h"
-#include "core/dom/DocumentFragment.h"
-#include "core/dom/Element.h"
#include "core/dom/MutationObserverInterestGroup.h"
#include "core/dom/MutationRecord.h"
#include "core/dom/Node.h"
diff --git a/Source/core/dom/ClassNodeList.cpp b/Source/core/dom/ClassNodeList.cpp
index dc6f36d..7ab3202 100644
--- a/Source/core/dom/ClassNodeList.cpp
+++ b/Source/core/dom/ClassNodeList.cpp
@@ -32,7 +32,6 @@
#include "core/dom/Document.h"
#include "core/dom/NodeRareData.h"
-#include "core/dom/StyledElement.h"
namespace WebCore {
diff --git a/Source/core/dom/ClientRect.idl b/Source/core/dom/ClientRect.idl
index 3dc5b03..2d96ed0 100644
--- a/Source/core/dom/ClientRect.idl
+++ b/Source/core/dom/ClientRect.idl
@@ -25,7 +25,6 @@
*/
[
- ImplementationLacksVTable
] interface ClientRect {
readonly attribute float top;
readonly attribute float right;
diff --git a/Source/core/dom/ClientRectList.cpp b/Source/core/dom/ClientRectList.cpp
index f51c091..9d3ee0a 100644
--- a/Source/core/dom/ClientRectList.cpp
+++ b/Source/core/dom/ClientRectList.cpp
@@ -28,16 +28,17 @@
#include "core/dom/ClientRectList.h"
#include "core/dom/ClientRect.h"
-#include "core/dom/ExceptionCode.h"
namespace WebCore {
ClientRectList::ClientRectList()
{
+ ScriptWrappable::init(this);
}
ClientRectList::ClientRectList(const Vector<FloatQuad>& quads)
{
+ ScriptWrappable::init(this);
m_list.reserveInitialCapacity(quads.size());
for (size_t i = 0; i < quads.size(); ++i)
m_list.append(ClientRect::create(quads[i].enclosingBoundingBox()));
diff --git a/Source/core/dom/ClientRectList.h b/Source/core/dom/ClientRectList.h
index a8f6fd6..33f54c7 100644
--- a/Source/core/dom/ClientRectList.h
+++ b/Source/core/dom/ClientRectList.h
@@ -27,30 +27,31 @@
#ifndef ClientRectList_h
#define ClientRectList_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/platform/graphics/FloatQuad.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
namespace WebCore {
- class ClientRect;
+class ClientRect;
- class ClientRectList : public RefCounted<ClientRectList> {
- public:
- static PassRefPtr<ClientRectList> create() { return adoptRef(new ClientRectList); }
- static PassRefPtr<ClientRectList> create(const Vector<FloatQuad>& quads) { return adoptRef(new ClientRectList(quads)); }
- ~ClientRectList();
+class ClientRectList : public RefCounted<ClientRectList>, public ScriptWrappable {
+public:
+ static PassRefPtr<ClientRectList> create() { return adoptRef(new ClientRectList); }
+ static PassRefPtr<ClientRectList> create(const Vector<FloatQuad>& quads) { return adoptRef(new ClientRectList(quads)); }
+ ~ClientRectList();
- unsigned length() const;
- ClientRect* item(unsigned index);
+ unsigned length() const;
+ ClientRect* item(unsigned index);
- private:
- ClientRectList();
- explicit ClientRectList(const Vector<FloatQuad>&);
+private:
+ ClientRectList();
+ explicit ClientRectList(const Vector<FloatQuad>&);
- Vector<RefPtr<ClientRect> > m_list;
- };
+ Vector<RefPtr<ClientRect> > m_list;
+};
} // namespace WebCore
diff --git a/Source/core/dom/ClientRectList.idl b/Source/core/dom/ClientRectList.idl
index 8017c6b..2d35d67 100644
--- a/Source/core/dom/ClientRectList.idl
+++ b/Source/core/dom/ClientRectList.idl
@@ -25,7 +25,6 @@
*/
[
- ImplementationLacksVTable
] interface ClientRectList {
readonly attribute unsigned long length;
getter ClientRect item([IsIndex,Default=Undefined] optional unsigned long index);
diff --git a/Source/core/dom/Clipboard.cpp b/Source/core/dom/Clipboard.cpp
index 37d9772..694d750 100644
--- a/Source/core/dom/Clipboard.cpp
+++ b/Source/core/dom/Clipboard.cpp
@@ -20,21 +20,18 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "core/dom/Clipboard.h"
#include "core/fileapi/FileList.h"
-#include "core/loader/FrameLoader.h"
#include "core/loader/cache/CachedImage.h"
-#include "core/page/Frame.h"
-#include "core/platform/graphics/Image.h"
namespace WebCore {
-Clipboard::Clipboard(ClipboardAccessPolicy policy, ClipboardType clipboardType)
+Clipboard::Clipboard(ClipboardAccessPolicy policy, ClipboardType clipboardType)
: m_policy(policy)
, m_dropEffect("uninitialized")
, m_effectAllowed("uninitialized")
@@ -42,8 +39,9 @@
, m_clipboardType(clipboardType)
, m_dragImage(0)
{
+ ScriptWrappable::init(this);
}
-
+
void Clipboard::setAccessPolicy(ClipboardAccessPolicy policy)
{
// once you go numb, can never go back
@@ -101,7 +99,7 @@
static String IEOpFromDragOp(DragOperation op)
{
bool moveSet = !!((DragOperationGeneric | DragOperationMove) & op);
-
+
if ((moveSet && (op & DragOperationCopy) && (op & DragOperationLink))
|| (op == DragOperationEvery))
return "all";
@@ -150,11 +148,11 @@
{
if (!canReadTypes())
return false;
-
+
RefPtr<FileList> fileList = files();
if (fileList->isEmpty())
return false;
-
+
for (unsigned int f = 0; f < fileList->length(); f++) {
if (equalIgnoringCase(fileList->item(f)->type(), type))
return true;
@@ -166,16 +164,16 @@
{
if (!canReadTypes())
return false;
-
- return types().contains(type);
+
+ return types().contains(type);
}
-
+
void Clipboard::setDropEffect(const String &effect)
{
if (!isForDragAndDrop())
return;
- // The attribute must ignore any attempts to set it to a value other than none, copy, link, and move.
+ // The attribute must ignore any attempts to set it to a value other than none, copy, link, and move.
if (effect != "none" && effect != "copy" && effect != "link" && effect != "move")
return;
@@ -195,7 +193,7 @@
// we are passed isn't a valid effectAllowed, so we should ignore it,
// and not set m_effectAllowed.
- // The attribute must ignore any attempts to set it to a value other than
+ // The attribute must ignore any attempts to set it to a value other than
// none, copy, copyLink, copyMove, link, linkMove, move, all, and uninitialized.
return;
}
@@ -204,7 +202,7 @@
if (canWriteData())
m_effectAllowed = effect;
}
-
+
DragOperation convertDropZoneOperationToDragOperation(const String& dragOperation)
{
if (dragOperation == "copy")
diff --git a/Source/core/dom/Clipboard.h b/Source/core/dom/Clipboard.h
index 667389f..ef51bf3 100644
--- a/Source/core/dom/Clipboard.h
+++ b/Source/core/dom/Clipboard.h
@@ -24,6 +24,7 @@
#ifndef Clipboard_h
#define Clipboard_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/ClipboardAccessPolicy.h"
#include "core/dom/Node.h"
#include "core/loader/cache/CachedResourceHandle.h"
@@ -33,102 +34,102 @@
namespace WebCore {
- class DataTransferItemList;
- class DragData;
- class FileList;
- class Frame;
+class DataTransferItemList;
+class DragData;
+class FileList;
+class Frame;
- // State available during IE's events for drag and drop and copy/paste
- class Clipboard : public RefCounted<Clipboard> {
- public:
- // Whether this clipboard is serving a drag-drop or copy-paste request.
- enum ClipboardType {
- CopyAndPaste,
- DragAndDrop,
- };
-
- static PassRefPtr<Clipboard> create(ClipboardAccessPolicy, DragData*, Frame*);
-
- virtual ~Clipboard() { }
-
- bool isForCopyAndPaste() const { return m_clipboardType == CopyAndPaste; }
- bool isForDragAndDrop() const { return m_clipboardType == DragAndDrop; }
-
- String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_dropEffect; }
- void setDropEffect(const String&);
- bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitialized"; }
- String effectAllowed() const { return m_effectAllowed; }
- void setEffectAllowed(const String&);
-
- virtual void clearData(const String& type) = 0;
- virtual void clearAllData() = 0;
- virtual String getData(const String& type) const = 0;
- virtual bool setData(const String& type, const String& data) = 0;
-
- // extensions beyond IE's API
- virtual ListHashSet<String> types() const = 0;
- virtual PassRefPtr<FileList> files() const = 0;
-
- IntPoint dragLocation() const { return m_dragLoc; }
- CachedImage* dragImage() const { return m_dragImage.get(); }
- virtual void setDragImage(CachedImage*, const IntPoint&) = 0;
- Node* dragImageElement() const { return m_dragImageElement.get(); }
- virtual void setDragImageElement(Node*, const IntPoint&) = 0;
-
- virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
- virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
- virtual void writeURL(const KURL&, const String&, Frame*) = 0;
- virtual void writeRange(Range*, Frame*) = 0;
- virtual void writePlainText(const String&) = 0;
-
- virtual bool hasData() = 0;
-
- void setAccessPolicy(ClipboardAccessPolicy);
- bool canReadTypes() const;
- bool canReadData() const;
- bool canWriteData() const;
- // Note that the spec doesn't actually allow drag image modification outside the dragstart
- // event. This capability is maintained for backwards compatiblity for ports that have
- // supported this in the past. On many ports, attempting to set a drag image outside the
- // dragstart operation is a no-op anyway.
- bool canSetDragImage() const;
-
- DragOperation sourceOperation() const;
- DragOperation destinationOperation() const;
- void setSourceOperation(DragOperation);
- void setDestinationOperation(DragOperation);
-
- bool hasDropZoneType(const String&);
-
- void setDragHasStarted() { m_dragStarted = true; }
-
- virtual PassRefPtr<DataTransferItemList> items() = 0;
-
- protected:
- Clipboard(ClipboardAccessPolicy, ClipboardType);
-
- bool dragStarted() const { return m_dragStarted; }
-
- private:
- bool hasFileOfType(const String&) const;
- bool hasStringOfType(const String&) const;
-
- // Instead of using this member directly, prefer to use the can*() methods above.
- ClipboardAccessPolicy m_policy;
- String m_dropEffect;
- String m_effectAllowed;
- bool m_dragStarted;
- ClipboardType m_clipboardType;
-
- protected:
- IntPoint m_dragLoc;
- CachedResourceHandle<CachedImage> m_dragImage;
- RefPtr<Node> m_dragImageElement;
+// State available during IE's events for drag and drop and copy/paste
+class Clipboard : public RefCounted<Clipboard>, public ScriptWrappable {
+public:
+ // Whether this clipboard is serving a drag-drop or copy-paste request.
+ enum ClipboardType {
+ CopyAndPaste,
+ DragAndDrop,
};
- DragOperation convertDropZoneOperationToDragOperation(const String& dragOperation);
- String convertDragOperationToDropZoneOperation(DragOperation);
-
+ static PassRefPtr<Clipboard> create(ClipboardAccessPolicy, DragData*, Frame*);
+
+ virtual ~Clipboard() { }
+
+ bool isForCopyAndPaste() const { return m_clipboardType == CopyAndPaste; }
+ bool isForDragAndDrop() const { return m_clipboardType == DragAndDrop; }
+
+ String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_dropEffect; }
+ void setDropEffect(const String&);
+ bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitialized"; }
+ String effectAllowed() const { return m_effectAllowed; }
+ void setEffectAllowed(const String&);
+
+ virtual void clearData(const String& type) = 0;
+ virtual void clearAllData() = 0;
+ virtual String getData(const String& type) const = 0;
+ virtual bool setData(const String& type, const String& data) = 0;
+
+ // extensions beyond IE's API
+ virtual ListHashSet<String> types() const = 0;
+ virtual PassRefPtr<FileList> files() const = 0;
+
+ IntPoint dragLocation() const { return m_dragLoc; }
+ CachedImage* dragImage() const { return m_dragImage.get(); }
+ virtual void setDragImage(CachedImage*, const IntPoint&) = 0;
+ Node* dragImageElement() const { return m_dragImageElement.get(); }
+ virtual void setDragImageElement(Node*, const IntPoint&) = 0;
+
+ virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
+ virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
+ virtual void writeURL(const KURL&, const String&, Frame*) = 0;
+ virtual void writeRange(Range*, Frame*) = 0;
+ virtual void writePlainText(const String&) = 0;
+
+ virtual bool hasData() = 0;
+
+ void setAccessPolicy(ClipboardAccessPolicy);
+ bool canReadTypes() const;
+ bool canReadData() const;
+ bool canWriteData() const;
+ // Note that the spec doesn't actually allow drag image modification outside the dragstart
+ // event. This capability is maintained for backwards compatiblity for ports that have
+ // supported this in the past. On many ports, attempting to set a drag image outside the
+ // dragstart operation is a no-op anyway.
+ bool canSetDragImage() const;
+
+ DragOperation sourceOperation() const;
+ DragOperation destinationOperation() const;
+ void setSourceOperation(DragOperation);
+ void setDestinationOperation(DragOperation);
+
+ bool hasDropZoneType(const String&);
+
+ void setDragHasStarted() { m_dragStarted = true; }
+
+ virtual PassRefPtr<DataTransferItemList> items() = 0;
+
+protected:
+ Clipboard(ClipboardAccessPolicy, ClipboardType);
+
+ bool dragStarted() const { return m_dragStarted; }
+
+private:
+ bool hasFileOfType(const String&) const;
+ bool hasStringOfType(const String&) const;
+
+ // Instead of using this member directly, prefer to use the can*() methods above.
+ ClipboardAccessPolicy m_policy;
+ String m_dropEffect;
+ String m_effectAllowed;
+ bool m_dragStarted;
+ ClipboardType m_clipboardType;
+
+protected:
+ IntPoint m_dragLoc;
+ CachedResourceHandle<CachedImage> m_dragImage;
+ RefPtr<Node> m_dragImageElement;
+};
+
+DragOperation convertDropZoneOperationToDragOperation(const String& dragOperation);
+String convertDragOperationToDropZoneOperation(DragOperation);
+
} // namespace WebCore
#endif // Clipboard_h
diff --git a/Source/core/dom/Clipboard.idl b/Source/core/dom/Clipboard.idl
index da58a66..82453c7 100644
--- a/Source/core/dom/Clipboard.idl
+++ b/Source/core/dom/Clipboard.idl
@@ -27,7 +27,6 @@
*/
[
- SkipVTableValidation
] interface Clipboard {
[TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect;
[TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed;
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 7c3ff41..1fc31e7 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -23,8 +23,6 @@
#include "config.h"
#include "core/dom/ContainerNode.h"
-#include "HTMLNames.h"
-#include "core/accessibility/AXObjectCache.h"
#include "core/dom/ChildListMutationScope.h"
#include "core/dom/ContainerNodeAlgorithms.h"
#include "core/dom/EventNames.h"
@@ -33,21 +31,10 @@
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeRenderStyle.h"
#include "core/dom/NodeTraversal.h"
-#include "core/dom/TemplateContentDocumentFragment.h"
#include "core/html/HTMLCollection.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/loader/cache/MemoryCache.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
#include "core/page/Page.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/rendering/InlineTextBox.h"
-#include "core/rendering/RenderBox.h"
#include "core/rendering/RenderTheme.h"
#include "core/rendering/RenderWidget.h"
-#include "core/rendering/RootInlineBox.h"
#include <wtf/CurrentTime.h>
#include <wtf/Vector.h>
@@ -59,8 +46,7 @@
static void dispatchChildRemovalEvents(Node*);
static void updateTreeAfterInsertion(ContainerNode*, Node*, AttachBehavior);
-typedef pair<RefPtr<Node>, unsigned> CallbackParameters;
-typedef pair<NodeCallback, CallbackParameters> CallbackInfo;
+typedef pair<NodeCallback, RefPtr<Node> > CallbackInfo;
typedef Vector<CallbackInfo> NodeCallbackQueue;
static NodeCallbackQueue* s_postAttachCallbackQueue;
@@ -714,12 +700,11 @@
--s_attachDepth;
}
-void ContainerNode::queuePostAttachCallback(NodeCallback callback, Node* node, unsigned callbackData)
+void ContainerNode::queuePostAttachCallback(NodeCallback callback, Node* node)
{
if (!s_postAttachCallbackQueue)
s_postAttachCallbackQueue = new NodeCallbackQueue;
-
- s_postAttachCallbackQueue->append(CallbackInfo(callback, CallbackParameters(node, callbackData)));
+ s_postAttachCallbackQueue->append(CallbackInfo(callback, node));
}
bool ContainerNode::postAttachCallbacksAreSuspended()
@@ -733,27 +718,11 @@
// can add more callbacks to the end of the queue.
for (size_t i = 0; i < s_postAttachCallbackQueue->size(); ++i) {
const CallbackInfo& info = (*s_postAttachCallbackQueue)[i];
- NodeCallback callback = info.first;
- CallbackParameters params = info.second;
-
- callback(params.first.get(), params.second);
+ info.first(info.second.get());
}
s_postAttachCallbackQueue->clear();
}
-static void needsStyleRecalcCallback(Node* node, unsigned data)
-{
- node->setNeedsStyleRecalc(static_cast<StyleChangeType>(data));
-}
-
-void ContainerNode::scheduleSetNeedsStyleRecalc(StyleChangeType changeType)
-{
- if (postAttachCallbacksAreSuspended())
- queuePostAttachCallback(needsStyleRecalcCallback, this, static_cast<unsigned>(changeType));
- else
- setNeedsStyleRecalc(changeType);
-}
-
void ContainerNode::attach()
{
attachChildren();
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index b29abf7..55c3bf4 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -35,7 +35,7 @@
class FloatPoint;
class HTMLCollection;
-typedef void (*NodeCallback)(Node*, unsigned);
+typedef void (*NodeCallback)(Node*);
namespace Private {
template<class GenericNode, class GenericNodeContainer>
@@ -118,7 +118,6 @@
virtual void setFocus(bool) OVERRIDE;
virtual void setActive(bool active = true, bool pause = false) OVERRIDE;
virtual void setHovered(bool = true) OVERRIDE;
- virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange) OVERRIDE FINAL;
// -----------------------------------------------------------------------------
// Notification of document structure changes (see core/dom/Node.h for more notification methods)
@@ -141,7 +140,7 @@
protected:
ContainerNode(Document*, ConstructionType = CreateContainer);
- static void queuePostAttachCallback(NodeCallback, Node*, unsigned = 0);
+ static void queuePostAttachCallback(NodeCallback, Node*);
static bool postAttachCallbacksAreSuspended();
template<class GenericNode, class GenericNodeContainer>
diff --git a/Source/core/dom/ContextDestructionObserver.cpp b/Source/core/dom/ContextDestructionObserver.cpp
index eec9bda..6750d80 100644
--- a/Source/core/dom/ContextDestructionObserver.cpp
+++ b/Source/core/dom/ContextDestructionObserver.cpp
@@ -28,7 +28,6 @@
#include "core/dom/ContextDestructionObserver.h"
#include "core/dom/ScriptExecutionContext.h"
-#include "core/dom/WebCoreMemoryInstrumentation.h"
namespace WebCore {
diff --git a/Source/core/dom/ContextFeatures.cpp b/Source/core/dom/ContextFeatures.cpp
index ec125c9..fa374bd 100644
--- a/Source/core/dom/ContextFeatures.cpp
+++ b/Source/core/dom/ContextFeatures.cpp
@@ -66,14 +66,9 @@
bool ContextFeatures::pagePopupEnabled(Document* document)
{
-#if ENABLE(PAGE_POPUP)
if (!document)
return false;
return document->contextFeatures()->isEnabled(document, PagePopup, false);
-#else
- UNUSED_PARAM(document);
- return false;
-#endif
}
bool ContextFeatures::htmlNotificationsEnabled(Document* document)
diff --git a/Source/core/dom/CustomElementConstructor.idl b/Source/core/dom/CustomElementConstructor.idl
index d5c0726..4b6d84f 100644
--- a/Source/core/dom/CustomElementConstructor.idl
+++ b/Source/core/dom/CustomElementConstructor.idl
@@ -26,6 +26,6 @@
NoInterfaceObject,
EnabledAtRuntime=customDOMElements,
WrapAsFunction,
- CustomCall
+ CustomLegacyCall
] interface CustomElementConstructor {
};
diff --git a/Source/core/dom/CustomElementDefinition.cpp b/Source/core/dom/CustomElementDefinition.cpp
index 803023d..48326b7 100644
--- a/Source/core/dom/CustomElementDefinition.cpp
+++ b/Source/core/dom/CustomElementDefinition.cpp
@@ -32,24 +32,17 @@
#include "core/dom/CustomElementDefinition.h"
+#include "SVGNames.h"
#include "bindings/v8/CustomElementHelpers.h"
#include <wtf/Assertions.h>
-#if ENABLE(SVG)
-#include "SVGNames.h"
-#endif
-
namespace WebCore {
PassRefPtr<CustomElementDefinition> CustomElementDefinition::create(ScriptState* state, const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, const ScriptValue& prototype)
{
ASSERT(CustomElementHelpers::isValidPrototypeParameter(prototype, state));
ASSERT(name == type || QualifiedName(nullAtom, name, namespaceURI) == *CustomElementHelpers::findLocalName(prototype));
-#if ENABLE(SVG)
ASSERT(namespaceURI == HTMLNames::xhtmlNamespaceURI || namespaceURI == SVGNames::svgNamespaceURI);
-#else
- ASSERT(namespaceURI == HTMLNames::xhtmlNamespaceURI);
-#endif
RefPtr<CustomElementDefinition> created = adoptRef(new CustomElementDefinition(type, name, namespaceURI, prototype));
return created.release();
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp
index 779526a..c812306 100644
--- a/Source/core/dom/CustomElementRegistry.cpp
+++ b/Source/core/dom/CustomElementRegistry.cpp
@@ -33,7 +33,7 @@
#include "core/dom/CustomElementRegistry.h"
#include "HTMLNames.h"
-#include "RuntimeEnabledFeatures.h"
+#include "SVGNames.h"
#include "bindings/v8/CustomElementHelpers.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/ScriptValue.h"
@@ -41,11 +41,7 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/html/HTMLElement.h"
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/svg/SVGElement.h"
-#endif
namespace WebCore {
@@ -88,7 +84,6 @@
DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
if (reservedNames.isEmpty()) {
-#if ENABLE(SVG)
reservedNames.append(SVGNames::color_profileTag.localName());
reservedNames.append(SVGNames::font_faceTag.localName());
reservedNames.append(SVGNames::font_face_srcTag.localName());
@@ -96,7 +91,6 @@
reservedNames.append(SVGNames::font_face_formatTag.localName());
reservedNames.append(SVGNames::font_face_nameTag.localName());
reservedNames.append(SVGNames::missing_glyphTag.localName());
-#endif
}
if (notFound != reservedNames.find(name))
@@ -228,10 +222,8 @@
if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI())
element = HTMLElement::create(tagName, document());
-#if ENABLE(SVG)
else if (SVGNames::svgNamespaceURI == tagName.namespaceURI())
element = SVGElement::create(tagName, document());
-#endif
else
return Element::create(tagName, document());
diff --git a/Source/core/dom/DOMCoreException.h b/Source/core/dom/DOMCoreException.h
index 64fd5cc..1a98c6e 100644
--- a/Source/core/dom/DOMCoreException.h
+++ b/Source/core/dom/DOMCoreException.h
@@ -29,11 +29,12 @@
#ifndef DOMCoreException_h
#define DOMCoreException_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/ExceptionBase.h"
namespace WebCore {
-class DOMCoreException : public ExceptionBase {
+class DOMCoreException : public ExceptionBase, public ScriptWrappable {
public:
static PassRefPtr<DOMCoreException> create(const ExceptionCodeDescription& description)
{
@@ -46,6 +47,7 @@
explicit DOMCoreException(const ExceptionCodeDescription& description)
: ExceptionBase(description)
{
+ ScriptWrappable::init(this);
}
};
diff --git a/Source/core/dom/DOMCoreException.idl b/Source/core/dom/DOMCoreException.idl
index 2b6f16e..3df6046 100644
--- a/Source/core/dom/DOMCoreException.idl
+++ b/Source/core/dom/DOMCoreException.idl
@@ -28,8 +28,7 @@
[
DoNotCheckConstants,
- InterfaceName=DOMException,
- ImplementationLacksVTable
+ InterfaceName=DOMException
] exception DOMCoreException {
readonly attribute unsigned short code;
diff --git a/Source/core/dom/DOMError.cpp b/Source/core/dom/DOMError.cpp
index 32ceeb5..38f6781 100644
--- a/Source/core/dom/DOMError.cpp
+++ b/Source/core/dom/DOMError.cpp
@@ -33,6 +33,7 @@
DOMError::DOMError(const String& name)
: m_name(name)
{
+ ScriptWrappable::init(this);
}
} // namespace WebCore
diff --git a/Source/core/dom/DOMError.h b/Source/core/dom/DOMError.h
index ecfa66b..ae23e74 100644
--- a/Source/core/dom/DOMError.h
+++ b/Source/core/dom/DOMError.h
@@ -26,13 +26,14 @@
#ifndef DOMError_h
#define DOMError_h
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
namespace WebCore {
-class DOMError : public RefCounted<DOMError> {
+class DOMError : public RefCounted<DOMError>, public ScriptWrappable {
public:
static PassRefPtr<DOMError> create(const String& name)
{
diff --git a/Source/core/dom/DOMError.idl b/Source/core/dom/DOMError.idl
index 81fa031..5cded18 100644
--- a/Source/core/dom/DOMError.idl
+++ b/Source/core/dom/DOMError.idl
@@ -26,8 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface DOMError {
readonly attribute DOMString name;
};
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index 07c6c66..280cee2 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -25,9 +25,8 @@
#include "config.h"
#include "core/dom/DOMImplementation.h"
-#include <wtf/StdLibExtras.h>
#include "HTMLNames.h"
-#include "XMLNames.h"
+#include "SVGNames.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/MediaList.h"
#include "core/css/StyleSheetContents.h"
@@ -42,21 +41,16 @@
#include "core/html/PluginDocument.h"
#include "core/html/TextDocument.h"
#include "core/loader/FrameLoader.h"
-#include "core/loader/FrameLoaderClient.h"
#include "core/page/Frame.h"
#include "core/page/Page.h"
-#include "core/page/Settings.h"
#include "core/platform/ContentType.h"
#include "core/platform/MIMETypeRegistry.h"
#include "core/platform/graphics/Image.h"
#include "core/platform/graphics/MediaPlayer.h"
#include "core/plugins/PluginData.h"
-#include "weborigin/SecurityOrigin.h"
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/svg/SVGDocument.h"
-#endif
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/StdLibExtras.h"
namespace WebCore {
@@ -67,8 +61,6 @@
set.add(string);
}
-#if ENABLE(SVG)
-
static bool isSVG10Feature(const String &feature, const String &version)
{
if (!version.isEmpty() && version != "1.0")
@@ -164,7 +156,6 @@
return feature.startsWith("http://www.w3.org/tr/svg11/feature#", false)
&& svgFeatures.contains(feature.right(feature.length() - 35));
}
-#endif
static bool isEvents2Feature(const String &feature, const String &version)
{
@@ -235,12 +226,10 @@
if (isEvents3Feature(feature, version))
return true;
-#if ENABLE(SVG)
if (isSVG11Feature(feature, version))
return true;
if (isSVG10Feature(feature, version))
return true;
-#endif
return false;
}
@@ -264,12 +253,9 @@
const String& qualifiedName, DocumentType* doctype, ExceptionCode& ec)
{
RefPtr<Document> doc;
-#if ENABLE(SVG)
if (namespaceURI == SVGNames::svgNamespaceURI)
doc = SVGDocument::create(0, KURL());
- else
-#endif
- if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
+ else if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
doc = Document::createXHTML(0, KURL());
else
doc = Document::create(0, KURL());
@@ -429,11 +415,8 @@
return PluginDocument::create(frame, url);
if (isTextMIMEType(type))
return TextDocument::create(frame, url);
-
-#if ENABLE(SVG)
if (type == "image/svg+xml")
return SVGDocument::create(frame, url);
-#endif
if (isXMLMIMEType(type))
return Document::create(frame, url);
diff --git a/Source/core/dom/DOMImplementation.idl b/Source/core/dom/DOMImplementation.idl
index d7ef3be..0040c11 100644
--- a/Source/core/dom/DOMImplementation.idl
+++ b/Source/core/dom/DOMImplementation.idl
@@ -19,8 +19,7 @@
*/
[
- GenerateIsReachable=ImplDocument,
- ImplementationLacksVTable
+ GenerateIsReachable=document
] interface DOMImplementation {
// DOM Level 1
diff --git a/Source/core/dom/DOMNamedFlowCollection.idl b/Source/core/dom/DOMNamedFlowCollection.idl
index b8bda55..90d2a44 100644
--- a/Source/core/dom/DOMNamedFlowCollection.idl
+++ b/Source/core/dom/DOMNamedFlowCollection.idl
@@ -30,8 +30,7 @@
[
NoInterfaceObject,
EnabledAtRuntime=cssRegions,
- InterfaceName=WebKitNamedFlowCollection,
- ImplementationLacksVTable
+ InterfaceName=WebKitNamedFlowCollection
] interface DOMNamedFlowCollection {
readonly attribute unsigned long length;
getter NamedFlow item(unsigned long index);
diff --git a/Source/core/dom/DOMStringList.idl b/Source/core/dom/DOMStringList.idl
index 5109dc6..1c75bcb 100644
--- a/Source/core/dom/DOMStringList.idl
+++ b/Source/core/dom/DOMStringList.idl
@@ -24,7 +24,6 @@
*/
[
- ImplementationLacksVTable
] interface DOMStringList {
readonly attribute unsigned long length;
[TreatReturnedNullStringAs=Null] getter DOMString item([Default=Undefined] optional unsigned long index);
diff --git a/Source/core/dom/DOMStringMap.h b/Source/core/dom/DOMStringMap.h
index f731761..7dc41b6 100644
--- a/Source/core/dom/DOMStringMap.h
+++ b/Source/core/dom/DOMStringMap.h
@@ -49,6 +49,22 @@
virtual bool contains(const String& name) = 0;
virtual void setItem(const String& name, const String& value, ExceptionCode&) = 0;
virtual void deleteItem(const String& name, ExceptionCode&) = 0;
+ bool anonymousNamedSetter(const String& name, const String& value, ExceptionCode& ec)
+ {
+ setItem(name, value, ec);
+ return true;
+ }
+ bool anonymousNamedDeleter(const AtomicString& name, ExceptionCode& ec)
+ {
+ deleteItem(name, ec);
+ bool result = !ec;
+ // DOMStringMap deleter should ignore exception.
+ // Behavior of Firefox and Opera are same.
+ // delete document.body.dataset["-foo"] // false instead of DOM Exception 12
+ // LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-multiple.html
+ ec = 0;
+ return result;
+ }
virtual Element* element() = 0;
diff --git a/Source/core/dom/DOMStringMap.idl b/Source/core/dom/DOMStringMap.idl
index e200cc8..59c9993 100644
--- a/Source/core/dom/DOMStringMap.idl
+++ b/Source/core/dom/DOMStringMap.idl
@@ -24,12 +24,11 @@
*/
[
- GenerateIsReachable=ImplElementRoot,
- CustomNamedGetter,
- CustomDeleteProperty,
- CustomEnumerateProperty,
- CustomNamedSetter,
- SkipVTableValidation
+ GenerateIsReachable=element,
+ CustomEnumerateProperty
] interface DOMStringMap {
+ [ImplementedAs=item, OverrideBuiltins] getter DOMString (DOMString name);
+ [ImplementedAs=anonymousNamedDeleter, RaisesException] deleter boolean (DOMString name);
+ [ImplementedAs=anonymousNamedSetter, RaisesException, OverrideBuiltins] setter DOMString (DOMString name, DOMString value);
};
diff --git a/Source/core/dom/DataTransferItem.h b/Source/core/dom/DataTransferItem.h
index b540c7d..31fb28c 100644
--- a/Source/core/dom/DataTransferItem.h
+++ b/Source/core/dom/DataTransferItem.h
@@ -31,8 +31,9 @@
#ifndef DataTransferItem_h
#define DataTransferItem_h
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
namespace WebCore {
@@ -41,8 +42,13 @@
class StringCallback;
class ScriptExecutionContext;
-class DataTransferItem : public RefCounted<DataTransferItem> {
+class DataTransferItem : public RefCounted<DataTransferItem>, public ScriptWrappable {
public:
+ DataTransferItem()
+ {
+ ScriptWrappable::init(this);
+ }
+
virtual ~DataTransferItem() { }
static const char kindString[];
diff --git a/Source/core/dom/DataTransferItem.idl b/Source/core/dom/DataTransferItem.idl
index c10e6fe..4ce2992 100644
--- a/Source/core/dom/DataTransferItem.idl
+++ b/Source/core/dom/DataTransferItem.idl
@@ -29,8 +29,7 @@
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface DataTransferItem {
readonly attribute DOMString kind;
readonly attribute DOMString type;
diff --git a/Source/core/dom/DataTransferItemList.h b/Source/core/dom/DataTransferItemList.h
index fa12510..4e9c6d6 100644
--- a/Source/core/dom/DataTransferItemList.h
+++ b/Source/core/dom/DataTransferItemList.h
@@ -31,9 +31,10 @@
#ifndef DataTransferItemList_h
#define DataTransferItemList_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/DataTransferItem.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
namespace WebCore {
@@ -42,8 +43,13 @@
typedef int ExceptionCode;
-class DataTransferItemList : public RefCounted<DataTransferItemList> {
+class DataTransferItemList : public RefCounted<DataTransferItemList>, public ScriptWrappable {
public:
+ DataTransferItemList()
+ {
+ ScriptWrappable::init(this);
+ }
+
virtual ~DataTransferItemList() { }
virtual size_t length() const = 0;
diff --git a/Source/core/dom/DataTransferItemList.idl b/Source/core/dom/DataTransferItemList.idl
index 184426b..07e9e2a 100644
--- a/Source/core/dom/DataTransferItemList.idl
+++ b/Source/core/dom/DataTransferItemList.idl
@@ -29,8 +29,7 @@
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface DataTransferItemList {
readonly attribute long length;
getter DataTransferItem item([Default=Undefined] optional unsigned long index);
diff --git a/Source/core/dom/DecodedDataDocumentParser.cpp b/Source/core/dom/DecodedDataDocumentParser.cpp
index 9f25650..da89429 100644
--- a/Source/core/dom/DecodedDataDocumentParser.cpp
+++ b/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -28,7 +28,6 @@
#include "core/loader/DocumentWriter.h"
#include "core/loader/TextResourceDecoder.h"
-#include "core/platform/text/SegmentedString.h"
namespace WebCore {
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 84cf458..0620531 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -42,12 +42,15 @@
#include "HTMLElementFactory.h"
#include "HTMLNames.h"
#include "RuntimeEnabledFeatures.h"
+#include "SVGElementFactory.h"
+#include "SVGNames.h"
#include "XMLNSNames.h"
#include "XMLNames.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptEventListener.h"
#include "core/accessibility/AXObjectCache.h"
+#include "core/animation/DocumentTimeline.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSStyleDeclaration.h"
#include "core/css/CSSStyleSheet.h"
@@ -142,6 +145,7 @@
#include "core/loader/TextResourceDecoder.h"
#include "core/loader/cache/CachedCSSStyleSheet.h"
#include "core/loader/cache/CachedResourceLoader.h"
+#include "core/page/CaptionUserPreferences.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
#include "core/page/ContentSecurityPolicy.h"
@@ -184,6 +188,9 @@
#include "core/rendering/RenderView.h"
#include "core/rendering/RenderWidget.h"
#include "core/rendering/TextAutosizer.h"
+#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGSVGElement.h"
+#include "core/svg/SVGStyleElement.h"
#include "core/workers/SharedWorkerRepository.h"
#include "core/xml/XMLHttpRequest.h"
#include "core/xml/XPathEvaluator.h"
@@ -197,16 +204,6 @@
#include "weborigin/SecurityOrigin.h"
#include "weborigin/SecurityPolicy.h"
-#if ENABLE(SVG)
-#include "SVGElementFactory.h"
-#include "SVGNames.h"
-#include "core/svg/SVGDocumentExtensions.h"
-#include "core/svg/SVGSVGElement.h"
-#include "core/svg/SVGStyleElement.h"
-#endif
-
-#include "core/page/CaptionUserPreferences.h"
-
using namespace std;
using namespace WTF;
using namespace Unicode;
@@ -373,6 +370,31 @@
uint64_t Document::s_globalTreeVersion = 0;
+// This class should be passed only to Document::postTask.
+class CheckFocusedNodeTask FINAL : public ScriptExecutionContext::Task {
+public:
+ static PassOwnPtr<CheckFocusedNodeTask> create()
+ {
+ return adoptPtr(new CheckFocusedNodeTask());
+ }
+ virtual ~CheckFocusedNodeTask() { }
+
+private:
+ CheckFocusedNodeTask() { }
+ virtual void performTask(ScriptExecutionContext* context) OVERRIDE
+ {
+ ASSERT(context->isDocument());
+ Document* document = toDocument(context);
+ document->didRunCheckFocusedNodeTask();
+ if (!document->focusedNode())
+ return;
+ if (document->focusedNode()->renderer() && document->focusedNode()->renderer()->needsLayout())
+ return;
+ if (!document->focusedNode()->isFocusable())
+ document->setFocusedNode(0);
+ }
+};
+
Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentClasses)
: ContainerNode(0, CreateDocument)
, TreeScope(this)
@@ -382,6 +404,7 @@
, m_contextFeatures(ContextFeatures::defaultSwitch())
, m_compatibilityMode(NoQuirksMode)
, m_compatibilityModeLocked(false)
+ , m_didPostCheckFocusedNodeTask(false)
, m_domTreeVersion(++s_globalTreeVersion)
, m_mutationObserverTypes(0)
, m_styleSheetCollection(DocumentStyleSheetCollection::create(this))
@@ -620,6 +643,8 @@
// so tear down scope information upfront to avoid having stale references in the map.
destroyTreeScopeData();
removeDetachedChildren();
+ // removeDetachedChildren() can access FormController.
+ m_formController.clear();
m_markers->detach();
@@ -882,7 +907,7 @@
PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()
{
- return StylePropertySet::create()->ensureCSSStyleDeclaration();
+ return MutableStylePropertySet::create()->ensureCSSStyleDeclaration();
}
PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode& ec)
@@ -1052,10 +1077,8 @@
// FIXME: Use registered namespaces and look up in a hash to find the right factory.
if (qName.namespaceURI() == xhtmlNamespaceURI)
e = HTMLElementFactory::createHTMLElement(qName, this, 0, createdByParser);
-#if ENABLE(SVG)
else if (qName.namespaceURI() == SVGNames::svgNamespaceURI)
e = SVGElementFactory::createSVGElement(qName, this, createdByParser);
-#endif
if (e)
m_sawElementsInKnownNamespaces = true;
@@ -1710,6 +1733,12 @@
// Only do a layout if changes have occurred that make it necessary.
if (frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout()))
frameView->layout();
+
+ // FIXME: Using a Task doesn't look a good idea.
+ if (m_focusedNode && !m_didPostCheckFocusedNodeTask) {
+ postTask(CheckFocusedNodeTask::create());
+ m_didPostCheckFocusedNodeTask = true;
+ }
}
// FIXME: This is a bad idea and needs to be removed eventually.
@@ -1846,12 +1875,7 @@
recalcStyle(Force);
- RenderObject* render = renderer();
- setRenderer(0);
-
ContainerNode::attach();
-
- setRenderer(render);
}
void Document::detach()
@@ -1992,8 +2016,10 @@
void Document::setVisuallyOrdered()
{
m_visuallyOrdered = true;
+ // FIXME: How is possible to not have a renderer here?
if (renderer())
renderer()->style()->setRTLOrdering(VisualOrder);
+ scheduleForcedStyleRecalc();
}
PassRefPtr<DocumentParser> Document::createParser()
@@ -2212,13 +2238,11 @@
HTMLLinkElement::dispatchPendingLoadEvents();
HTMLStyleElement::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);
@@ -2283,10 +2307,8 @@
}
}
-#if ENABLE(SVG)
if (svgExtensions())
accessSVGExtensions()->startAnimations();
-#endif
}
void Document::setParsing(bool b)
@@ -2774,7 +2796,7 @@
#ifndef NDEBUG
m_didDispatchViewportPropertiesChanged = true;
#endif
- page()->chrome()->dispatchViewportPropertiesDidChange(m_viewportArguments);
+ page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments);
}
}
@@ -2796,7 +2818,13 @@
{
ASSERT(!renderer() || renderer()->isRenderView());
- if (!renderer())
+ // RenderView::hitTest causes a layout, and we don't want to hit that until the first
+ // layout because until then, there is nothing shown on the screen - the user can't
+ // have intentionally clicked on something belonging to this page. Furthermore,
+ // mousemove events before the first layout should not lead to a premature layout()
+ // happening, which could show a flash of white.
+ // See also the similar code in EventHandler::hitTestResultAtPoint.
+ if (!renderer() || !view() || !view()->didFirstLayout())
return MouseEventWithHitTestResults(event, HitTestResult(LayoutPoint()));
HitTestResult result(documentPoint);
@@ -3229,7 +3257,7 @@
}
if (!focusChangeBlocked)
- page()->chrome()->focusedNodeChanged(m_focusedNode.get());
+ page()->chrome().focusedNodeChanged(m_focusedNode.get());
SetFocusedNodeDone:
updateStyleIfNeeded();
@@ -3921,6 +3949,7 @@
void Document::applyXSLTransform(ProcessingInstruction* pi)
{
+ UseCounter::count(this, UseCounter::XSLProcessingInstruction);
RefPtr<XSLTProcessor> processor = XSLTProcessor::create();
processor->setXSLStyleSheet(static_cast<XSLStyleSheet*>(pi->sheet()));
String resultMIMEType;
@@ -4001,7 +4030,6 @@
return Attr::create(this, qName, emptyString());
}
-#if ENABLE(SVG)
const SVGDocumentExtensions* Document::svgExtensions()
{
return m_svgExtensions.get();
@@ -4018,7 +4046,6 @@
{
return documentElement() && documentElement()->hasTagName(SVGNames::svgTag);
}
-#endif
PassRefPtr<HTMLCollection> Document::ensureCachedCollection(CollectionType type)
{
@@ -4710,7 +4737,7 @@
// 5. Return, and run the remaining steps asynchronously.
// 6. Optionally, perform some animation.
m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT;
- page()->chrome()->client()->enterFullScreenForElement(element);
+ page()->chrome().client()->enterFullScreenForElement(element);
// 7. Optionally, display a message indicating how the user can exit displaying the context object fullscreen.
return;
@@ -4801,12 +4828,12 @@
// Only exit out of full screen window mode if there are no remaining elements in the
// full screen stack.
if (!newTop) {
- page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get());
+ page()->chrome().client()->exitFullScreenForElement(m_fullScreenElement.get());
return;
}
// Otherwise, notify the chrome of the new full screen element.
- page()->chrome()->client()->enterFullScreenForElement(newTop);
+ page()->chrome().client()->enterFullScreenForElement(newTop);
}
bool Document::webkitFullscreenEnabled() const
@@ -4935,33 +4962,6 @@
m_fullScreenRenderer = 0;
}
-void Document::setFullScreenRendererSize(const IntSize& size)
-{
- ASSERT(m_fullScreenRenderer);
- if (!m_fullScreenRenderer)
- return;
-
- if (m_fullScreenRenderer) {
- RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->style());
- newStyle->setWidth(Length(size.width(), WebCore::Fixed));
- newStyle->setHeight(Length(size.height(), WebCore::Fixed));
- newStyle->setTop(Length(0, WebCore::Fixed));
- newStyle->setLeft(Length(0, WebCore::Fixed));
- m_fullScreenRenderer->setStyle(newStyle);
- updateLayout();
- }
-}
-
-void Document::setFullScreenRendererBackgroundColor(Color backgroundColor)
-{
- if (!m_fullScreenRenderer)
- return;
-
- RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->style());
- newStyle->setBackgroundColor(backgroundColor);
- m_fullScreenRenderer->setStyle(newStyle);
-}
-
void Document::fullScreenChangeDelayTimerFired(Timer<Document>*)
{
// Since we dispatch events in this function, it's possible that the
@@ -5027,11 +5027,6 @@
fullScreenElementRemoved();
}
-bool Document::isAnimatingFullScreen() const
-{
- return m_isAnimatingFullScreen;
-}
-
void Document::setAnimatingFullScreen(bool flag)
{
if (m_isAnimatingFullScreen == flag)
@@ -5155,7 +5150,7 @@
m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationStartTime);
}
-PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const
+PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force) const
{
// FIXME: It's not clear from the documentation at
// http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
@@ -5216,7 +5211,7 @@
if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
scrollingCoordinator->touchEventTargetRectsDidChange(this);
if (m_touchEventTargets->size() == 1)
- page->chrome()->client()->needTouchEvents(true);
+ page->chrome().client()->needTouchEvents(true);
}
}
@@ -5242,7 +5237,7 @@
if (frame->document() && frame->document()->hasTouchEventHandlers())
return;
}
- page->chrome()->client()->needTouchEvents(false);
+ page->chrome().client()->needTouchEvents(false);
}
void Document::didRemoveEventTargetNode(Node* handler)
@@ -5541,9 +5536,7 @@
info.addMember(m_transformSourceDocument, "transformSourceDocument");
info.addMember(m_decoder, "decoder");
info.addMember(m_xpathEvaluator, "xpathEvaluator");
-#if ENABLE(SVG)
info.addMember(m_svgExtensions, "svgExtensions");
-#endif
info.addMember(m_selectorQueryCache, "selectorQueryCache");
info.addMember(m_renderer, "renderer");
info.addMember(m_weakFactory, "weakFactory");
@@ -5630,7 +5623,7 @@
Vector<RefPtr<Element> > associatedFormControls;
copyToVector(m_associatedFormControls, associatedFormControls);
- frame()->page()->chrome()->client()->didAssociateFormControls(associatedFormControls);
+ frame()->page()->chrome().client()->didAssociateFormControls(associatedFormControls);
m_associatedFormControls.clear();
}
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index 2da5a7e..b643c2e 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -28,7 +28,6 @@
#ifndef Document_h
#define Document_h
-#include "core/animation/DocumentTimeline.h"
#include "core/dom/ContainerNode.h"
#include "core/dom/DOMTimeStamp.h"
#include "core/dom/DocumentEventQueue.h"
@@ -88,6 +87,7 @@
class DocumentParser;
class DocumentSharedObjectPool;
class DocumentStyleSheetCollection;
+class DocumentTimeline;
class DocumentType;
class Element;
class Event;
@@ -132,6 +132,7 @@
class RenderFullScreen;
class RenderView;
class RequestAnimationFrameCallback;
+class SVGDocumentExtensions;
class ScriptElementData;
class ScriptRunner;
class ScriptableDocumentParser;
@@ -159,10 +160,6 @@
class XPathNSResolver;
class XPathResult;
-#if ENABLE(SVG)
-class SVGDocumentExtensions;
-#endif
-
struct AnnotatedRegionValue;
class FontLoader;
@@ -409,11 +406,7 @@
bool isPluginDocument() const { return m_documentClasses & PluginDocumentClass; }
bool isMediaDocument() const { return m_documentClasses & MediaDocumentClass; }
-#if ENABLE(SVG)
bool hasSVGRootNode() const;
-#else
- static bool hasSVGRootNode() { return false; }
-#endif
bool isFrameSet() const;
@@ -643,7 +636,7 @@
Node* focusedNode() const { return m_focusedNode.get(); }
UserActionElementSet& userActionElements() { return m_userActionElements; }
const UserActionElementSet& userActionElements() const { return m_userActionElements; }
-
+ void didRunCheckFocusedNodeTask() { m_didPostCheckFocusedNodeTask = false; }
void getFocusableNodes(Vector<RefPtr<Node> >&);
// The m_ignoreAutofocus flag specifies whether or not the document has been changed by the user enough
@@ -950,10 +943,8 @@
virtual void removeAllEventListeners();
-#if ENABLE(SVG)
const SVGDocumentExtensions* svgExtensions();
SVGDocumentExtensions* accessSVGExtensions();
-#endif
void initSecurityContext();
void initContentSecurityPolicy();
@@ -999,15 +990,12 @@
void setFullScreenRenderer(RenderFullScreen*);
RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer; }
void fullScreenRendererDestroyed();
-
- void setFullScreenRendererSize(const IntSize&);
- void setFullScreenRendererBackgroundColor(Color);
-
+
void fullScreenChangeDelayTimerFired(Timer<Document>*);
bool fullScreenIsAllowedForElement(Element*) const;
void fullScreenElementRemoved();
void removeFullScreenElementOfSubtree(Node*, bool amongChildrenOnly = false);
- bool isAnimatingFullScreen() const;
+ bool isAnimatingFullScreen() const { return m_isAnimatingFullScreen; }
void setAnimatingFullScreen(bool);
// W3C API
@@ -1023,7 +1011,7 @@
void decrementLoadEventDelayCount();
bool isDelayingLoadEvent() const { return m_loadEventDelayCount; }
- PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const;
+ PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force) const;
const DocumentTiming* timing() const { return &m_documentTiming; }
@@ -1251,6 +1239,7 @@
Color m_textColor;
+ bool m_didPostCheckFocusedNodeTask;
RefPtr<Node> m_focusedNode;
RefPtr<Node> m_hoverNode;
RefPtr<Element> m_activeElement;
@@ -1345,9 +1334,7 @@
RefPtr<XPathEvaluator> m_xpathEvaluator;
-#if ENABLE(SVG)
OwnPtr<SVGDocumentExtensions> m_svgExtensions;
-#endif
Vector<AnnotatedRegionValue> m_annotatedRegions;
bool m_hasAnnotatedRegions;
diff --git a/Source/core/dom/Document.idl b/Source/core/dom/Document.idl
index 02f2bb5..abee356 100644
--- a/Source/core/dom/Document.idl
+++ b/Source/core/dom/Document.idl
@@ -263,17 +263,17 @@
[NotEnumerable] attribute EventListener onwebkitpointerlockerror;
[NotEnumerable, EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] attribute EventListener onsecuritypolicyviolation;
- [EnabledAtRuntime=touch, RaisesException] Touch createTouch([Default=Undefined] optional DOMWindow window,
- [Default=Undefined] optional EventTarget target,
- [Default=Undefined] optional long identifier,
- [Default=Undefined] optional long pageX,
- [Default=Undefined] optional long pageY,
- [Default=Undefined] optional long screenX,
- [Default=Undefined] optional long screenY,
- [Default=Undefined] optional long webkitRadiusX,
- [Default=Undefined] optional long webkitRadiusY,
- [Default=Undefined] optional float webkitRotationAngle,
- [Default=Undefined] optional float webkitForce);
+ [EnabledAtRuntime=touch] Touch createTouch([Default=Undefined] optional DOMWindow window,
+ [Default=Undefined] optional EventTarget target,
+ [Default=Undefined] optional long identifier,
+ [Default=Undefined] optional long pageX,
+ [Default=Undefined] optional long pageY,
+ [Default=Undefined] optional long screenX,
+ [Default=Undefined] optional long screenY,
+ [Default=Undefined] optional long webkitRadiusX,
+ [Default=Undefined] optional long webkitRadiusY,
+ [Default=Undefined] optional float webkitRotationAngle,
+ [Default=Undefined] optional float webkitForce);
[EnabledAtRuntime=touch, Custom, RaisesException] TouchList createTouchList();
[EnabledAtRuntime=customDOMElements, ImplementedAs=registerElement, CallWith=ScriptState, DeliverCustomElementCallbacks, RaisesException] CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options);
diff --git a/Source/core/dom/DocumentEventQueue.cpp b/Source/core/dom/DocumentEventQueue.cpp
index 4e160d0..67678ee 100644
--- a/Source/core/dom/DocumentEventQueue.cpp
+++ b/Source/core/dom/DocumentEventQueue.cpp
@@ -30,7 +30,6 @@
#include "core/dom/Document.h"
#include "core/dom/Event.h"
#include "core/dom/EventNames.h"
-#include "core/dom/ScriptExecutionContext.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include "core/page/DOMWindow.h"
#include "core/page/SuspendableTimer.h"
diff --git a/Source/core/dom/DocumentFragment.cpp b/Source/core/dom/DocumentFragment.cpp
index 6c56322..cf3e7ad 100644
--- a/Source/core/dom/DocumentFragment.cpp
+++ b/Source/core/dom/DocumentFragment.cpp
@@ -25,8 +25,6 @@
#include "core/dom/Document.h"
#include "core/html/parser/HTMLDocumentParser.h"
-#include "core/page/Page.h"
-#include "core/page/Settings.h"
#include "core/xml/parser/XMLDocumentParser.h"
namespace WebCore {
diff --git a/Source/core/dom/DocumentFragment.idl b/Source/core/dom/DocumentFragment.idl
index 01ca5de..f02cf18 100644
--- a/Source/core/dom/DocumentFragment.idl
+++ b/Source/core/dom/DocumentFragment.idl
@@ -19,8 +19,7 @@
[
Constructor,
- CallWith=ScriptExecutionContext,
- SkipVTableValidation
+ CallWith=ScriptExecutionContext
] interface DocumentFragment : Node {
// NodeSelector - Selector API
[RaisesException] Element querySelector(DOMString selectors);
diff --git a/Source/core/dom/DocumentStyleSheetCollection.cpp b/Source/core/dom/DocumentStyleSheetCollection.cpp
index 4735ab2..ab2b188 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.cpp
+++ b/Source/core/dom/DocumentStyleSheetCollection.cpp
@@ -30,12 +30,9 @@
#include "HTMLNames.h"
#include "SVGNames.h"
-#include "bindings/v8/DOMWrapperWorld.h"
#include "core/css/CSSStyleSheet.h"
-#include "core/css/SelectorChecker.h"
#include "core/css/StyleInvalidationAnalysis.h"
#include "core/css/StyleSheetContents.h"
-#include "core/css/StyleSheetList.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
@@ -285,11 +282,7 @@
m_document->applyXSLTransform(pi);
return;
}
- } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag)))
-#if ENABLE(SVG)
- || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
-#endif
- ) {
+ } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) {
Element* e = toElement(n);
AtomicString title = e->getAttribute(titleAttr);
bool enabledViaScript = false;
@@ -315,12 +308,9 @@
}
// Get the current preferred styleset. This is the
// set of sheets that will be enabled.
-#if ENABLE(SVG)
if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
sheet = static_cast<SVGStyleElement*>(n)->sheet();
- else
-#endif
- if (e->hasLocalName(linkTag))
+ else if (e->hasLocalName(linkTag))
sheet = static_cast<HTMLLinkElement*>(n)->sheet();
else
// <STYLE> element
@@ -470,7 +460,7 @@
else {
StyleResolver* styleResolver = m_document->styleResolver();
if (styleResolverUpdateType == Reset) {
- styleResolver->ruleSets().resetAuthorStyle();
+ styleResolver->resetAuthorStyle();
styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets);
} else {
ASSERT(styleResolverUpdateType == Additive);
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index e8645e2..1f96a0e 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -27,11 +27,9 @@
#include "core/dom/Element.h"
#include "HTMLNames.h"
-#include "XMLNSNames.h"
+#include "SVGNames.h"
#include "XMLNames.h"
#include "core/accessibility/AXObjectCache.h"
-#include "core/css/CSSParser.h"
-#include "core/css/CSSSelectorList.h"
#include "core/css/StylePropertySet.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Attr.h"
@@ -40,17 +38,14 @@
#include "core/dom/CustomElementRegistry.h"
#include "core/dom/DatasetDOMStringMap.h"
#include "core/dom/Document.h"
-#include "core/dom/DocumentFragment.h"
#include "core/dom/DocumentSharedObjectPool.h"
#include "core/dom/ElementRareData.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/MutationObserverInterestGroup.h"
#include "core/dom/MutationRecord.h"
#include "core/dom/NamedNodeMap.h"
-#include "core/dom/NodeList.h"
#include "core/dom/NodeRenderStyle.h"
#include "core/dom/NodeRenderingContext.h"
-#include "core/dom/NodeTraversal.h"
#include "core/dom/PseudoElement.h"
#include "core/dom/SelectorQuery.h"
#include "core/dom/Text.h"
@@ -61,7 +56,6 @@
#include "core/editing/TextIterator.h"
#include "core/editing/htmlediting.h"
#include "core/html/ClassList.h"
-#include "core/html/DOMTokenList.h"
#include "core/html/HTMLCollection.h"
#include "core/html/HTMLDocument.h"
#include "core/html/HTMLElement.h"
@@ -70,28 +64,21 @@
#include "core/html/HTMLLabelElement.h"
#include "core/html/HTMLOptionsCollection.h"
#include "core/html/HTMLTableRowsCollection.h"
-#include "core/html/VoidCallback.h"
#include "core/html/parser/HTMLParserIdioms.h"
-#include "core/inspector/InspectorInstrumentation.h"
#include "core/page/FocusController.h"
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
#include "core/page/Page.h"
#include "core/page/PointerLockController.h"
-#include "core/page/Settings.h"
#include "core/rendering/FlowThreadController.h"
#include "core/rendering/RenderRegion.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/RenderWidget.h"
-#include <wtf/BitVector.h>
-#include <wtf/MemoryInstrumentationVector.h>
-#include <wtf/text/CString.h>
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGElement.h"
-#endif
+#include "wtf/BitVector.h"
+#include "wtf/MemoryInstrumentationVector.h"
+#include "wtf/text/CString.h"
namespace WebCore {
@@ -213,12 +200,10 @@
if (hasSyntheticAttrChildNodes())
detachAllAttrNodesFromElement();
-#if ENABLE(SVG)
if (hasPendingResources()) {
document()->accessSVGExtensions()->removeElementFromPendingResources(this);
ASSERT(!hasPendingResources());
}
-#endif
}
inline ElementRareData* Element::elementRareData() const
@@ -390,12 +375,10 @@
ASSERT(isStyledElement());
static_cast<const StyledElement*>(this)->synchronizeStyleAttributeInternal();
}
-#if ENABLE(SVG)
if (elementData()->m_animatedSVGAttributesAreDirty) {
ASSERT(isSVGElement());
toSVGElement(this)->synchronizeAnimatedSVGAttribute(anyQName());
}
-#endif
}
inline void Element::synchronizeAttribute(const QualifiedName& name) const
@@ -407,12 +390,10 @@
static_cast<const StyledElement*>(this)->synchronizeStyleAttributeInternal();
return;
}
-#if ENABLE(SVG)
if (UNLIKELY(elementData()->m_animatedSVGAttributesAreDirty)) {
ASSERT(isSVGElement());
toSVGElement(this)->synchronizeAnimatedSVGAttribute(name);
}
-#endif
}
inline void Element::synchronizeAttribute(const AtomicString& localName) const
@@ -426,13 +407,11 @@
static_cast<const StyledElement*>(this)->synchronizeStyleAttributeInternal();
return;
}
-#if ENABLE(SVG)
if (elementData()->m_animatedSVGAttributesAreDirty) {
// We're not passing a namespace argument on purpose. SVGNames::*Attr are defined w/o namespaces as well.
ASSERT(isSVGElement());
static_cast<const SVGElement*>(this)->synchronizeAnimatedSVGAttribute(QualifiedName(nullAtom, localName, nullAtom));
}
-#endif
}
const AtomicString& Element::getAttribute(const QualifiedName& name) const
@@ -696,16 +675,13 @@
return IntRect();
Vector<FloatQuad> quads;
-#if ENABLE(SVG)
if (isSVGElement() && renderer()) {
// Get the bounding rectangle from the SVG model.
SVGElement* svgElement = toSVGElement(this);
FloatRect localRect;
if (svgElement->getBoundingBox(localRect))
quads.append(renderer()->localToAbsoluteQuad(localRect));
- } else
-#endif
- {
+ } else {
// Get the bounding rectangle from the box model.
if (renderBoxModelObject())
renderBoxModelObject()->absoluteQuads(quads);
@@ -744,16 +720,13 @@
document()->updateLayoutIgnorePendingStylesheets();
Vector<FloatQuad> quads;
-#if ENABLE(SVG)
if (isSVGElement() && renderer() && !renderer()->isSVGRoot()) {
// Get the bounding rectangle from the SVG model.
SVGElement* svgElement = toSVGElement(this);
FloatRect localRect;
if (svgElement->getBoundingBox(localRect))
quads.append(renderer()->localToAbsoluteQuad(localRect));
- } else
-#endif
- {
+ } else {
// Get the bounding rectangle from the box model.
if (renderBoxModelObject())
renderBoxModelObject()->absoluteQuads(quads);
@@ -1183,18 +1156,9 @@
{
}
-bool Element::isDisabledFormControl() const
-{
- // FIXME: disabled and inert are separate concepts in the spec, but now we treat them as the same.
- // For example, an inert, non-disabled form control should not be grayed out.
- if (isInert())
- return true;
- return false;
-}
-
bool Element::isInert() const
{
- Element* dialog = document()->activeModalDialog();
+ const Element* dialog = document()->activeModalDialog();
return dialog && !containsIncludingShadowDOM(dialog) && !dialog->containsIncludingShadowDOM(this);
}
@@ -1241,9 +1205,7 @@
void Element::removedFrom(ContainerNode* insertionPoint)
{
-#if ENABLE(SVG)
bool wasInDocument = insertionPoint->document();
-#endif
if (Element* before = pseudoElement(BEFORE))
before->removedFrom(insertionPoint);
@@ -1277,10 +1239,8 @@
}
ContainerNode::removedFrom(insertionPoint);
-#if ENABLE(SVG)
if (wasInDocument && hasPendingResources())
document()->accessSVGExtensions()->removeElementFromPendingResources(this);
-#endif
}
void Element::createRendererIfNeeded()
@@ -1399,6 +1359,8 @@
void Element::recalcStyle(StyleChange change)
{
+ ASSERT(document()->inStyleRecalc());
+
if (hasCustomStyleCallbacks())
willRecalcStyle(change);
@@ -1497,9 +1459,10 @@
if (shouldRecalcStyle(change, this))
updatePseudoElement(AFTER, change);
+ setAttached();
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();
-
+
if (hasCustomStyleCallbacks())
didRecalcStyle(change);
InspectorInstrumentation::didRecalculateStyleForElement(this);
@@ -2436,7 +2399,6 @@
setAttribute(attributeName, String::number(value));
}
-#if ENABLE(SVG)
bool Element::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
// Only create renderers for SVG elements whose parents are SVG elements, or for proper <svg xmlns="svgNS"> subdocuments.
@@ -2445,7 +2407,6 @@
return ContainerNode::childShouldCreateRenderer(childContext);
}
-#endif
void Element::webkitRequestFullscreen()
{
@@ -2494,7 +2455,7 @@
// We must ensure a reattach occurs so the renderer is inserted in the correct sibling order under RenderView according to its
// top layer position, or in its usual place if not in the top layer.
- reattachIfAttached();
+ lazyReattachIfAttached();
}
void Element::webkitRequestPointerLock()
@@ -2589,10 +2550,8 @@
if (name == HTMLNames::styleAttr)
return false;
-#if ENABLE(SVG)
if (isSVGElement())
return !static_cast<const SVGElement*>(this)->isAnimatableAttribute(name);
-#endif
return true;
}
@@ -2746,6 +2705,19 @@
return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLCollection>(this, type);
}
+static void needsSyntheticStyleChangeCallback(Node* node)
+{
+ node->setNeedsStyleRecalc(SyntheticStyleChange);
+}
+
+void Element::scheduleSyntheticStyleChange()
+{
+ if (postAttachCallbacksAreSuspended())
+ queuePostAttachCallback(needsSyntheticStyleChangeCallback, this);
+ else
+ setNeedsStyleRecalc(SyntheticStyleChange);
+}
+
HTMLCollection* Element::cachedHTMLCollection(CollectionType type)
{
return hasRareData() && rareData()->nodeLists() ? rareData()->nodeLists()->cacheWithAtomicName<HTMLCollection>(type) : 0;
@@ -2900,7 +2872,6 @@
return ensureElementRareData()->ensureInputMethodContext(toHTMLElement(this));
}
-#if ENABLE(SVG)
bool Element::hasPendingResources() const
{
return hasRareData() && elementRareData()->hasPendingResources();
@@ -2915,7 +2886,6 @@
{
ensureElementRareData()->setHasPendingResources(false);
}
-#endif
void ElementData::deref()
{
@@ -2933,9 +2903,7 @@
, m_arraySize(0)
, m_presentationAttributeStyleIsDirty(false)
, m_styleAttributeIsDirty(false)
-#if ENABLE(SVG)
, m_animatedSVGAttributesAreDirty(false)
-#endif
{
}
@@ -2944,9 +2912,7 @@
, m_arraySize(arraySize)
, m_presentationAttributeStyleIsDirty(false)
, m_styleAttributeIsDirty(false)
-#if ENABLE(SVG)
, m_animatedSVGAttributesAreDirty(false)
-#endif
{
}
@@ -3005,9 +2971,7 @@
, m_arraySize(isUnique ? 0 : other.length())
, m_presentationAttributeStyleIsDirty(other.m_presentationAttributeStyleIsDirty)
, m_styleAttributeIsDirty(other.m_styleAttributeIsDirty)
-#if ENABLE(SVG)
, m_animatedSVGAttributesAreDirty(other.m_animatedSVGAttributesAreDirty)
-#endif
, m_classNames(other.m_classNames)
, m_idForStyleResolution(other.m_idForStyleResolution)
{
@@ -3023,7 +2987,7 @@
, m_presentationAttributeStyle(other.m_presentationAttributeStyle)
, m_attributeVector(other.m_attributeVector)
{
- m_inlineStyle = other.m_inlineStyle ? other.m_inlineStyle->copy() : 0;
+ m_inlineStyle = other.m_inlineStyle ? other.m_inlineStyle->mutableCopy() : 0;
}
UniqueElementData::UniqueElementData(const ShareableElementData& other)
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index f5870e2..5aae441 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -100,9 +100,7 @@
unsigned m_arraySize : 28;
mutable unsigned m_presentationAttributeStyleIsDirty : 1;
mutable unsigned m_styleAttributeIsDirty : 1;
-#if ENABLE(SVG)
mutable unsigned m_animatedSVGAttributesAreDirty : 1;
-#endif
mutable RefPtr<StylePropertySet> m_inlineStyle;
mutable SpaceSplitString m_classNames;
@@ -113,9 +111,7 @@
friend class StyledElement;
friend class ShareableElementData;
friend class UniqueElementData;
-#if ENABLE(SVG)
friend class SVGElement;
-#endif
const Attribute* attributeBase() const;
const Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
@@ -359,9 +355,9 @@
bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; }
bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); }
- const AtomicString& localName() const { return m_tagName.localName(); }
- const AtomicString& prefix() const { return m_tagName.prefix(); }
- const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
+ virtual const AtomicString& localName() const OVERRIDE { return m_tagName.localName(); }
+ virtual const AtomicString& prefix() const OVERRIDE { return m_tagName.prefix(); }
+ virtual const AtomicString& namespaceURI() const OVERRIDE { return m_tagName.namespaceURI(); }
virtual KURL baseURI() const OVERRIDE FINAL;
@@ -370,6 +366,8 @@
PassRefPtr<Element> cloneElementWithChildren();
PassRefPtr<Element> cloneElementWithoutChildren();
+ void scheduleSyntheticStyleChange();
+
void normalizeAttributes();
String nodeNamePreservingCase() const;
@@ -546,18 +544,16 @@
// Used for disabled form elements; if true, prevents mouse events from being dispatched
// to event listeners, and prevents DOMActivate events from being sent at all.
- virtual bool isDisabledFormControl() const;
+ virtual bool isDisabledFormControl() const { return false; }
bool isInert() const;
virtual bool shouldBeReparentedUnderRenderView(const RenderStyle*) const { return isInTopLayer(); }
-#if ENABLE(SVG)
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
bool hasPendingResources() const;
void setHasPendingResources();
void clearHasPendingResources();
virtual void buildPendingResource() { };
-#endif
enum {
ALLOW_KEYBOARD_INPUT = 1 << 0,
@@ -680,9 +676,6 @@
void cancelFocusAppearanceUpdate();
- virtual const AtomicString& virtualPrefix() const OVERRIDE FINAL { return prefix(); }
- virtual const AtomicString& virtualLocalName() const OVERRIDE FINAL { return localName(); }
- virtual const AtomicString& virtualNamespaceURI() const OVERRIDE FINAL { return namespaceURI(); }
virtual RenderStyle* virtualComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return computedStyle(pseudoElementSpecifier); }
// cloneNode is private so that non-virtual cloneElementWithChildren and cloneElementWithoutChildren
@@ -839,10 +832,8 @@
{
if (!hasClass())
return nullAtom;
-#if ENABLE(SVG)
if (isSVGElement())
return getAttribute(HTMLNames::classAttr);
-#endif
return fastGetAttribute(HTMLNames::classAttr);
}
diff --git a/Source/core/dom/Element.idl b/Source/core/dom/Element.idl
index 52be687..831e32c 100644
--- a/Source/core/dom/Element.idl
+++ b/Source/core/dom/Element.idl
@@ -19,8 +19,7 @@
*/
[
- CustomToV8,
- SkipVTableValidation
+ CustomToV8
] interface Element : Node {
// DOM Level 1 Core
@@ -28,12 +27,12 @@
[TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName;
[TreatReturnedNullStringAs=Null] DOMString getAttribute([Default=Undefined] optional DOMString name);
- [RaisesException] void setAttribute([Default=Undefined] optional DOMString name,
+ [RaisesException] void setAttribute([Default=Undefined] optional DOMString name,
[Default=Undefined] optional DOMString value);
void removeAttribute([Default=Undefined] optional DOMString name);
Attr getAttributeNode([Default=Undefined] optional DOMString name);
- [RaisesException] Attr setAttributeNode([Default=Undefined] optional Attr newAttr);
- [RaisesException] Attr removeAttributeNode([Default=Undefined] optional Attr oldAttr);
+ [RaisesException] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
+ [RaisesException] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr);
[PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
// For ObjC this is defined on Node for legacy support.
@@ -53,7 +52,7 @@
[Default=Undefined] optional DOMString localName);
Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
- [RaisesException] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr);
+ [RaisesException] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
boolean hasAttribute(DOMString name);
boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
diff --git a/Source/core/dom/ElementRareData.h b/Source/core/dom/ElementRareData.h
index 3c512cb..649515f 100644
--- a/Source/core/dom/ElementRareData.h
+++ b/Source/core/dom/ElementRareData.h
@@ -133,10 +133,8 @@
m_activeAnimations = animations;
}
-#if ENABLE(SVG)
bool hasPendingResources() const { return m_hasPendingResources; }
void setHasPendingResources(bool has) { m_hasPendingResources = has; }
-#endif
InputMethodContext* ensureInputMethodContext(HTMLElement* element)
{
@@ -154,9 +152,7 @@
unsigned m_isInCanvasSubtree : 1;
unsigned m_containsFullScreenElement : 1;
unsigned m_isInTopLayer : 1;
-#if ENABLE(SVG)
unsigned m_hasPendingResources : 1;
-#endif
unsigned m_childrenAffectedByHover : 1;
unsigned m_childrenAffectedByActive : 1;
unsigned m_childrenAffectedByDrag : 1;
@@ -203,9 +199,7 @@
, m_isInCanvasSubtree(false)
, m_containsFullScreenElement(false)
, m_isInTopLayer(false)
-#if ENABLE(SVG)
, m_hasPendingResources(false)
-#endif
, m_childrenAffectedByHover(false)
, m_childrenAffectedByActive(false)
, m_childrenAffectedByDrag(false)
diff --git a/Source/core/dom/Entity.idl b/Source/core/dom/Entity.idl
index 7f5bf4b..12b9234 100644
--- a/Source/core/dom/Entity.idl
+++ b/Source/core/dom/Entity.idl
@@ -17,7 +17,6 @@
* Boston, MA 02110-1301, USA.
*/
[
- ImplementationLacksVTable
] interface Entity : Node {
[TreatReturnedNullStringAs=Null] readonly attribute DOMString publicId;
[TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId;
diff --git a/Source/core/dom/Event.cpp b/Source/core/dom/Event.cpp
index 4fc4330..c713e0d 100644
--- a/Source/core/dom/Event.cpp
+++ b/Source/core/dom/Event.cpp
@@ -23,11 +23,9 @@
#include "config.h"
#include "core/dom/Event.h"
-#include "core/dom/EventDispatcher.h"
#include "core/dom/EventNames.h"
#include "core/dom/EventTarget.h"
#include "core/dom/StaticNodeList.h"
-#include "core/dom/UserGestureIndicator.h"
#include "core/dom/WebCoreMemoryInstrumentation.h"
#include <wtf/CurrentTime.h>
#include <wtf/text/AtomicString.h>
diff --git a/Source/core/dom/Event.h b/Source/core/dom/Event.h
index 0ec17f8..f736261 100644
--- a/Source/core/dom/Event.h
+++ b/Source/core/dom/Event.h
@@ -94,6 +94,7 @@
void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
const AtomicString& type() const { return m_type; }
+ void setType(const AtomicString& type) { m_type = type; }
EventTarget* target() const { return m_target.get(); }
void setTarget(PassRefPtr<EventTarget>);
diff --git a/Source/core/dom/Event.idl b/Source/core/dom/Event.idl
index aa4f375..680b038 100644
--- a/Source/core/dom/Event.idl
+++ b/Source/core/dom/Event.idl
@@ -21,9 +21,8 @@
// Introduced in DOM Level 2:
[
CustomToV8,
- ConstructorTemplate=Event,
+ ConstructorTemplate=Event
- SkipVTableValidation
] interface Event {
// DOM PhaseType
@@ -73,7 +72,7 @@
attribute boolean returnValue;
attribute boolean cancelBubble;
- [EnabledAtRuntime=experimentalShadowDOM] NodeList path();
+ [EnabledAtRuntime=experimentalShadowDOM] readonly attribute NodeList path;
[Custom] readonly attribute Clipboard clipboardData;
};
diff --git a/Source/core/dom/EventContext.cpp b/Source/core/dom/EventContext.cpp
index 30a44c5..dee63c1 100644
--- a/Source/core/dom/EventContext.cpp
+++ b/Source/core/dom/EventContext.cpp
@@ -27,7 +27,6 @@
#include "config.h"
#include "core/dom/EventContext.h"
-#include "core/dom/Document.h"
#include "core/dom/Event.h"
#include "core/dom/FocusEvent.h"
#include "core/dom/MouseEvent.h"
@@ -35,7 +34,6 @@
#include "core/dom/StaticNodeList.h"
#include "core/dom/TouchEvent.h"
#include "core/dom/TouchList.h"
-#include "core/page/DOMWindow.h"
namespace WebCore {
diff --git a/Source/core/dom/EventDispatchMediator.cpp b/Source/core/dom/EventDispatchMediator.cpp
index 895b402..45c9206 100644
--- a/Source/core/dom/EventDispatchMediator.cpp
+++ b/Source/core/dom/EventDispatchMediator.cpp
@@ -33,8 +33,6 @@
#include "core/dom/Event.h"
#include "core/dom/EventDispatcher.h"
-#include "core/dom/EventRetargeter.h"
-#include "core/dom/Node.h"
namespace WebCore {
diff --git a/Source/core/dom/EventDispatcher.cpp b/Source/core/dom/EventDispatcher.cpp
index ccec89c..51e7cc1 100644
--- a/Source/core/dom/EventDispatcher.cpp
+++ b/Source/core/dom/EventDispatcher.cpp
@@ -29,15 +29,10 @@
#include "core/dom/ContainerNode.h"
#include "core/dom/EventContext.h"
#include "core/dom/EventDispatchMediator.h"
-#include "core/dom/EventPathWalker.h"
#include "core/dom/EventRetargeter.h"
#include "core/dom/MouseEvent.h"
#include "core/dom/ScopedEventQueue.h"
#include "core/dom/WindowEventContext.h"
-#include "core/dom/shadow/ElementShadow.h"
-#include "core/dom/shadow/InsertionPoint.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "core/html/HTMLMediaElement.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/page/FrameView.h"
#include <wtf/RefPtr.h>
diff --git a/Source/core/dom/EventException.h b/Source/core/dom/EventException.h
index 77bde1c..cc7c917 100644
--- a/Source/core/dom/EventException.h
+++ b/Source/core/dom/EventException.h
@@ -29,11 +29,12 @@
#ifndef EventException_h
#define EventException_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/ExceptionBase.h"
namespace WebCore {
-class EventException : public ExceptionBase {
+class EventException : public ExceptionBase, public ScriptWrappable {
public:
static PassRefPtr<EventException> create(const ExceptionCodeDescription& description)
{
@@ -54,6 +55,7 @@
explicit EventException(const ExceptionCodeDescription& description)
: ExceptionBase(description)
{
+ ScriptWrappable::init(this);
}
};
diff --git a/Source/core/dom/EventException.idl b/Source/core/dom/EventException.idl
index cde7100..7d05830 100644
--- a/Source/core/dom/EventException.idl
+++ b/Source/core/dom/EventException.idl
@@ -28,8 +28,7 @@
// Introduced in DOM Level 2:
[
- DoNotCheckConstants,
- ImplementationLacksVTable,
+ DoNotCheckConstants
] exception EventException {
readonly attribute unsigned short code;
diff --git a/Source/core/dom/EventListenerMap.cpp b/Source/core/dom/EventListenerMap.cpp
index 00d2506..7753865 100644
--- a/Source/core/dom/EventListenerMap.cpp
+++ b/Source/core/dom/EventListenerMap.cpp
@@ -33,8 +33,6 @@
#include "config.h"
#include "core/dom/EventListenerMap.h"
-#include "core/dom/Event.h"
-#include "core/dom/EventException.h"
#include "core/dom/EventTarget.h"
#include <wtf/MainThread.h>
#include <wtf/StdLibExtras.h>
@@ -158,8 +156,6 @@
return 0;
}
-#if ENABLE(SVG)
-
static void removeFirstListenerCreatedFromMarkup(EventListenerVector* listenerVector)
{
bool foundListener = false;
@@ -207,8 +203,6 @@
copyListenersNotCreatedFromMarkupToTarget(m_entries[i].first, m_entries[i].second.get(), target);
}
-#endif // ENABLE(SVG)
-
EventListenerIterator::EventListenerIterator()
: m_map(0)
, m_entryIndex(0)
diff --git a/Source/core/dom/EventListenerMap.h b/Source/core/dom/EventListenerMap.h
index c73364e..052018a 100644
--- a/Source/core/dom/EventListenerMap.h
+++ b/Source/core/dom/EventListenerMap.h
@@ -57,10 +57,8 @@
EventListenerVector* find(const AtomicString& eventType);
Vector<AtomicString> eventTypes() const;
-#if ENABLE(SVG)
void removeFirstEventListenerCreatedFromMarkup(const AtomicString& eventType);
void copyEventListenersNotCreatedFromMarkupToTarget(EventTarget*);
-#endif
private:
friend class EventListenerIterator;
diff --git a/Source/core/dom/EventNames.in b/Source/core/dom/EventNames.in
index 5ede665..437ba31 100644
--- a/Source/core/dom/EventNames.in
+++ b/Source/core/dom/EventNames.in
@@ -50,9 +50,9 @@
modules/device_orientation/DeviceMotionEvent
core/dom/DeviceOrientationEvent
OrientationEvent interfaceName=Event, conditional=ORIENTATION_EVENTS
-core/html/MediaKeyEvent conditional=ENCRYPTED_MEDIA
-MediaKeyMessageEvent conditional=ENCRYPTED_MEDIA_V2
-MediaKeyNeededEvent conditional=ENCRYPTED_MEDIA_V2
+core/html/MediaKeyEvent
+modules/encryptedmedia/MediaKeyMessageEvent conditional=ENCRYPTED_MEDIA_V2
+modules/encryptedmedia/MediaKeyNeededEvent conditional=ENCRYPTED_MEDIA_V2
core/html/track/TrackEvent
core/dom/AutocompleteErrorEvent
core/css/CSSFontFaceLoadEvent
diff --git a/Source/core/dom/EventRetargeter.h b/Source/core/dom/EventRetargeter.h
index 3e89f0f..f602a47 100644
--- a/Source/core/dom/EventRetargeter.h
+++ b/Source/core/dom/EventRetargeter.h
@@ -20,18 +20,15 @@
#ifndef EventRetargeter_h
#define EventRetargeter_h
+#include "SVGNames.h"
#include "core/dom/ContainerNode.h"
#include "core/dom/EventContext.h"
#include "core/dom/shadow/ShadowRoot.h"
-#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/svg/SVGElementInstance.h"
#include "core/svg/SVGUseElement.h"
-#endif
+#include "wtf/HashMap.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
namespace WebCore {
@@ -77,7 +74,6 @@
if (referenceNode->isPseudoElement())
return referenceNode->parentNode();
-#if ENABLE(SVG)
if (!referenceNode->isSVGElement() || !referenceNode->isInShadowTree())
return referenceNode;
@@ -90,7 +86,6 @@
SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowHostElement);
if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(referenceNode))
return instance;
-#endif
return referenceNode;
}
diff --git a/Source/core/dom/EventTarget.cpp b/Source/core/dom/EventTarget.cpp
index 0625587..68615b4 100644
--- a/Source/core/dom/EventTarget.cpp
+++ b/Source/core/dom/EventTarget.cpp
@@ -35,7 +35,6 @@
#include "bindings/v8/ScriptController.h"
#include "core/dom/Event.h"
#include "core/dom/EventException.h"
-#include "core/dom/TransitionEvent.h"
#include "core/inspector/InspectorInstrumentation.h"
#include <wtf/MainThread.h>
#include <wtf/StdLibExtras.h>
@@ -162,20 +161,6 @@
{
}
-static PassRefPtr<Event> createMatchingPrefixedEvent(const Event* event)
-{
- if (event->type() == eventNames().transitionendEvent) {
- const TransitionEvent* transitionEvent = static_cast<const TransitionEvent*>(event);
- RefPtr<Event> prefixedEvent = TransitionEvent::create(eventNames().webkitTransitionEndEvent, transitionEvent->propertyName(), transitionEvent->elapsedTime(), transitionEvent->pseudoElement());
- prefixedEvent->setTarget(event->target());
- prefixedEvent->setCurrentTarget(event->currentTarget());
- prefixedEvent->setEventPhase(event->eventPhase());
- return prefixedEvent.release();
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
static AtomicString prefixedType(const Event* event)
{
if (event->type() == eventNames().transitionendEvent)
@@ -202,8 +187,12 @@
if (listenerUnprefixedVector)
fireEventListeners(event, d, *listenerUnprefixedVector);
- else if (listenerPrefixedVector)
- fireEventListeners(createMatchingPrefixedEvent(event).get(), d, *listenerPrefixedVector);
+ else if (listenerPrefixedVector) {
+ AtomicString unprefixedTypeName = event->type();
+ event->setType(prefixedTypeName);
+ fireEventListeners(event, d, *listenerPrefixedVector);
+ event->setType(unprefixedTypeName);
+ }
if (!prefixedTypeName.isEmpty()) {
ScriptExecutionContext* context = scriptExecutionContext();
diff --git a/Source/core/dom/EventTargetFactory.in b/Source/core/dom/EventTargetFactory.in
index dc3235b..891a665 100644
--- a/Source/core/dom/EventTargetFactory.in
+++ b/Source/core/dom/EventTargetFactory.in
@@ -37,7 +37,7 @@
modules/speech/SpeechRecognition
modules/speech/SpeechSynthesisUtterance
modules/webaudio/AudioContext conditional=WEB_AUDIO
-modules/webaudio/ScriptProcessorNode conditional=WEB_AUDIO
+modules/webaudio/AudioNode conditional=WEB_AUDIO
modules/webmidi/MIDIInput
modules/webmidi/MIDIPort
modules/websockets/WebSocket
diff --git a/Source/core/dom/ExceptionBase.cpp b/Source/core/dom/ExceptionBase.cpp
index d6567c7..fcfd7ef 100644
--- a/Source/core/dom/ExceptionBase.cpp
+++ b/Source/core/dom/ExceptionBase.cpp
@@ -42,7 +42,7 @@
if (description.name)
m_message = m_name + ": " + description.typeName + " Exception " + String::number(description.code);
else
- m_message = makeString(description.typeName, " Exception ", String::number(description.code));
+ m_message = String(description.typeName) + " Exception " + String::number(description.code);
}
String ExceptionBase::toString() const
diff --git a/Source/core/dom/FocusEvent.cpp b/Source/core/dom/FocusEvent.cpp
index 80eebe0..e839fe7 100644
--- a/Source/core/dom/FocusEvent.cpp
+++ b/Source/core/dom/FocusEvent.cpp
@@ -30,7 +30,6 @@
#include "core/dom/EventDispatcher.h"
#include "core/dom/EventNames.h"
#include "core/dom/EventRetargeter.h"
-#include "core/dom/Node.h"
namespace WebCore {
diff --git a/Source/core/dom/KeyboardEvent.cpp b/Source/core/dom/KeyboardEvent.cpp
index 33e0a7c..25e42d4 100644
--- a/Source/core/dom/KeyboardEvent.cpp
+++ b/Source/core/dom/KeyboardEvent.cpp
@@ -23,13 +23,7 @@
#include "config.h"
#include "core/dom/KeyboardEvent.h"
-#include "core/dom/Document.h"
-#include "core/dom/EventDispatcher.h"
#include "core/dom/EventNames.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/Settings.h"
#include "core/platform/PlatformKeyboardEvent.h"
#include "core/platform/WindowsKeyboardCodes.h"
diff --git a/Source/core/dom/MessageChannel.cpp b/Source/core/dom/MessageChannel.cpp
index a27ac9e..4f2b284 100644
--- a/Source/core/dom/MessageChannel.cpp
+++ b/Source/core/dom/MessageChannel.cpp
@@ -36,6 +36,7 @@
: m_port1(MessagePort::create(*context))
, m_port2(MessagePort::create(*context))
{
+ ScriptWrappable::init(this);
MessagePortChannel::createChannel(m_port1.get(), m_port2.get());
}
diff --git a/Source/core/dom/MessageChannel.h b/Source/core/dom/MessageChannel.h
index 3d6579b..64b213c 100644
--- a/Source/core/dom/MessageChannel.h
+++ b/Source/core/dom/MessageChannel.h
@@ -27,29 +27,30 @@
#ifndef MessageChannel_h
#define MessageChannel_h
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
namespace WebCore {
- class MessagePort;
- class ScriptExecutionContext;
+class MessagePort;
+class ScriptExecutionContext;
- class MessageChannel : public RefCounted<MessageChannel> {
- public:
- static PassRefPtr<MessageChannel> create(ScriptExecutionContext* context) { return adoptRef(new MessageChannel(context)); }
- ~MessageChannel();
+class MessageChannel : public RefCounted<MessageChannel>, public ScriptWrappable {
+public:
+ static PassRefPtr<MessageChannel> create(ScriptExecutionContext* context) { return adoptRef(new MessageChannel(context)); }
+ ~MessageChannel();
- MessagePort* port1() const { return m_port1.get(); }
- MessagePort* port2() const { return m_port2.get(); }
+ MessagePort* port1() const { return m_port1.get(); }
+ MessagePort* port2() const { return m_port2.get(); }
- private:
- explicit MessageChannel(ScriptExecutionContext*);
+private:
+ explicit MessageChannel(ScriptExecutionContext*);
- RefPtr<MessagePort> m_port1;
- RefPtr<MessagePort> m_port2;
- };
+ RefPtr<MessagePort> m_port1;
+ RefPtr<MessagePort> m_port2;
+};
} // namespace WebCore
diff --git a/Source/core/dom/MessageChannel.idl b/Source/core/dom/MessageChannel.idl
index c81bd4c..07b1a10 100644
--- a/Source/core/dom/MessageChannel.idl
+++ b/Source/core/dom/MessageChannel.idl
@@ -27,8 +27,7 @@
[
Constructor,
CallWith=ScriptExecutionContext,
- CustomConstructor,
- ImplementationLacksVTable
+ CustomConstructor
] interface MessageChannel {
readonly attribute MessagePort port1;
diff --git a/Source/core/dom/MessageEvent.h b/Source/core/dom/MessageEvent.h
index 297a788..5912f8f 100644
--- a/Source/core/dom/MessageEvent.h
+++ b/Source/core/dom/MessageEvent.h
@@ -88,7 +88,7 @@
const String& origin() const { return m_origin; }
const String& lastEventId() const { return m_lastEventId; }
DOMWindow* source() const { return m_source.get(); }
- MessagePortArray* ports() const { return m_ports.get(); }
+ MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
virtual const AtomicString& interfaceName() const;
diff --git a/Source/core/dom/MessageEvent.idl b/Source/core/dom/MessageEvent.idl
index 928f2d7..a279331 100644
--- a/Source/core/dom/MessageEvent.idl
+++ b/Source/core/dom/MessageEvent.idl
@@ -31,8 +31,8 @@
[InitializedByEventConstructor] readonly attribute DOMString origin;
[InitializedByEventConstructor] readonly attribute DOMString lastEventId;
[InitializedByEventConstructor] readonly attribute DOMWindow source;
- [InitializedByEventConstructor, CachedAttribute, CustomGetter] readonly attribute any data;
- [InitializedByEventConstructor, CustomGetter] readonly attribute Array ports;
+ [InitializedByEventConstructor, CustomGetter] readonly attribute any data;
+ [InitializedByEventConstructor] readonly attribute MessagePort[] ports;
[Custom] void initMessageEvent([Default=Undefined] optional DOMString typeArg,
[Default=Undefined] optional boolean canBubbleArg,
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index d505c66..92fe39f 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -45,6 +45,7 @@
, m_closed(false)
, m_scriptExecutionContext(&scriptExecutionContext)
{
+ ScriptWrappable::init(this);
m_scriptExecutionContext->createdMessagePort(this);
// Don't need to call processMessagePortMessagesSoon() here, because the port will not be opened until start() is invoked.
diff --git a/Source/core/dom/MessagePort.h b/Source/core/dom/MessagePort.h
index 294df46..aa58831 100644
--- a/Source/core/dom/MessagePort.h
+++ b/Source/core/dom/MessagePort.h
@@ -27,94 +27,95 @@
#ifndef MessagePort_h
#define MessagePort_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/EventListener.h"
#include "core/dom/EventTarget.h"
#include "core/dom/MessagePortChannel.h"
-#include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
+#include "wtf/Forward.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
namespace WebCore {
- class Event;
- class Frame;
- class MessagePort;
- class ScriptExecutionContext;
+class Event;
+class Frame;
+class MessagePort;
+class ScriptExecutionContext;
- // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
- typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
+// The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
+typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
- class MessagePort : public RefCounted<MessagePort>, public EventTarget {
- public:
- static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
- virtual ~MessagePort();
+class MessagePort : public RefCounted<MessagePort>, public ScriptWrappable, public EventTarget {
+public:
+ static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
+ virtual ~MessagePort();
- void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionCode&);
+ void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionCode&);
- void start();
- void close();
+ void start();
+ void close();
- void entangle(PassOwnPtr<MessagePortChannel>);
- PassOwnPtr<MessagePortChannel> disentangle();
+ void entangle(PassOwnPtr<MessagePortChannel>);
+ PassOwnPtr<MessagePortChannel> disentangle();
- // Returns 0 if there is an exception, or if the passed-in array is 0/empty.
- static PassOwnPtr<MessagePortChannelArray> disentanglePorts(const MessagePortArray*, ExceptionCode&);
+ // Returns 0 if there is an exception, or if the passed-in array is 0/empty.
+ static PassOwnPtr<MessagePortChannelArray> disentanglePorts(const MessagePortArray*, ExceptionCode&);
- // Returns 0 if the passed array is 0/empty.
- static PassOwnPtr<MessagePortArray> entanglePorts(ScriptExecutionContext&, PassOwnPtr<MessagePortChannelArray>);
+ // Returns 0 if the passed array is 0/empty.
+ static PassOwnPtr<MessagePortArray> entanglePorts(ScriptExecutionContext&, PassOwnPtr<MessagePortChannelArray>);
- void messageAvailable();
- bool started() const { return m_started; }
+ void messageAvailable();
+ bool started() const { return m_started; }
- void contextDestroyed();
+ void contextDestroyed();
- virtual const AtomicString& interfaceName() const OVERRIDE;
- virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
- void dispatchMessages();
+ void dispatchMessages();
- using RefCounted<MessagePort>::ref;
- using RefCounted<MessagePort>::deref;
+ using RefCounted<MessagePort>::ref;
+ using RefCounted<MessagePort>::deref;
- bool hasPendingActivity();
+ bool hasPendingActivity();
- void setOnmessage(PassRefPtr<EventListener> listener)
- {
- setAttributeEventListener(eventNames().messageEvent, listener);
- start();
- }
- EventListener* onmessage() { return getAttributeEventListener(eventNames().messageEvent); }
+ void setOnmessage(PassRefPtr<EventListener> listener)
+ {
+ setAttributeEventListener(eventNames().messageEvent, listener);
+ start();
+ }
+ EventListener* onmessage() { return getAttributeEventListener(eventNames().messageEvent); }
- // Returns null if there is no entangled port, or if the entangled port is run by a different thread.
- // This is used solely to enable a GC optimization. Some platforms may not be able to determine ownership
- // of the remote port (since it may live cross-process) - those platforms may always return null.
- MessagePort* locallyEntangledPort();
+ // Returns null if there is no entangled port, or if the entangled port is run by a different thread.
+ // This is used solely to enable a GC optimization. Some platforms may not be able to determine ownership
+ // of the remote port (since it may live cross-process) - those platforms may always return null.
+ MessagePort* locallyEntangledPort();
- // A port starts out its life entangled, and remains entangled until it is closed or is cloned.
- bool isEntangled() { return !m_closed && !isNeutered(); }
+ // A port starts out its life entangled, and remains entangled until it is closed or is cloned.
+ bool isEntangled() { return !m_closed && !isNeutered(); }
- // A port gets neutered when it is transferred to a new owner via postMessage().
- bool isNeutered() { return !m_entangledChannel; }
+ // A port gets neutered when it is transferred to a new owner via postMessage().
+ bool isNeutered() { return !m_entangledChannel; }
- private:
- explicit MessagePort(ScriptExecutionContext&);
+private:
+ explicit MessagePort(ScriptExecutionContext&);
- virtual void refEventTarget() OVERRIDE { ref(); }
- virtual void derefEventTarget() OVERRIDE { deref(); }
- virtual EventTargetData* eventTargetData() OVERRIDE;
- virtual EventTargetData* ensureEventTargetData() OVERRIDE;
+ virtual void refEventTarget() OVERRIDE { ref(); }
+ virtual void derefEventTarget() OVERRIDE { deref(); }
+ virtual EventTargetData* eventTargetData() OVERRIDE;
+ virtual EventTargetData* ensureEventTargetData() OVERRIDE;
- OwnPtr<MessagePortChannel> m_entangledChannel;
+ OwnPtr<MessagePortChannel> m_entangledChannel;
- bool m_started;
- bool m_closed;
+ bool m_started;
+ bool m_closed;
- ScriptExecutionContext* m_scriptExecutionContext;
- EventTargetData m_eventTargetData;
- };
+ ScriptExecutionContext* m_scriptExecutionContext;
+ EventTargetData m_eventTargetData;
+};
} // namespace WebCore
diff --git a/Source/core/dom/MouseEvent.idl b/Source/core/dom/MouseEvent.idl
index 888ac71..5465735 100644
--- a/Source/core/dom/MouseEvent.idl
+++ b/Source/core/dom/MouseEvent.idl
@@ -18,8 +18,7 @@
*/
[
- ConstructorTemplate=Event,
- SkipVTableValidation
+ ConstructorTemplate=Event
] interface MouseEvent : UIEvent {
[InitializedByEventConstructor] readonly attribute long screenX;
[InitializedByEventConstructor] readonly attribute long screenY;
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index c1a3a07..4c46b09 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -65,6 +65,7 @@
: m_callback(callback)
, m_priority(s_observerPriority++)
{
+ ScriptWrappable::init(this);
}
MutationObserver::~MutationObserver()
diff --git a/Source/core/dom/MutationObserver.h b/Source/core/dom/MutationObserver.h
index 6d31277..643a4e9 100644
--- a/Source/core/dom/MutationObserver.h
+++ b/Source/core/dom/MutationObserver.h
@@ -31,13 +31,14 @@
#ifndef MutationObserver_h
#define MutationObserver_h
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/AtomicStringHash.h>
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/AtomicStringHash.h"
namespace WebCore {
@@ -52,7 +53,7 @@
typedef unsigned char MutationObserverOptions;
typedef unsigned char MutationRecordDeliveryOptions;
-class MutationObserver : public RefCounted<MutationObserver> {
+class MutationObserver : public RefCounted<MutationObserver>, public ScriptWrappable {
public:
enum MutationType {
ChildList = 1 << 0,
diff --git a/Source/core/dom/MutationObserver.idl b/Source/core/dom/MutationObserver.idl
index 6df62b7..e87fa44 100644
--- a/Source/core/dom/MutationObserver.idl
+++ b/Source/core/dom/MutationObserver.idl
@@ -29,8 +29,7 @@
*/
[
- CustomConstructor(MutationCallback callback),
- ImplementationLacksVTable
+ CustomConstructor(MutationCallback callback)
] interface MutationObserver {
[RaisesException] void observe(Node target, Dictionary options);
sequence<MutationRecord> takeRecords();
diff --git a/Source/core/dom/MutationObserverInterestGroup.cpp b/Source/core/dom/MutationObserverInterestGroup.cpp
index e018157..7169bb2 100644
--- a/Source/core/dom/MutationObserverInterestGroup.cpp
+++ b/Source/core/dom/MutationObserverInterestGroup.cpp
@@ -32,7 +32,6 @@
#include "core/dom/MutationObserverInterestGroup.h"
-#include "core/dom/MutationObserverRegistration.h"
#include "core/dom/MutationRecord.h"
#include "core/dom/Node.h"
#include "core/dom/QualifiedName.h"
diff --git a/Source/core/dom/MutationObserverRegistration.cpp b/Source/core/dom/MutationObserverRegistration.cpp
index f2b85a0..1ece4d1 100644
--- a/Source/core/dom/MutationObserverRegistration.cpp
+++ b/Source/core/dom/MutationObserverRegistration.cpp
@@ -32,7 +32,6 @@
#include "core/dom/MutationObserverRegistration.h"
-#include "core/dom/Document.h"
#include "core/dom/Node.h"
#include "core/dom/QualifiedName.h"
diff --git a/Source/core/dom/MutationRecord.h b/Source/core/dom/MutationRecord.h
index 4606df0..c5001c2 100644
--- a/Source/core/dom/MutationRecord.h
+++ b/Source/core/dom/MutationRecord.h
@@ -31,10 +31,11 @@
#ifndef MutationRecord_h
#define MutationRecord_h
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
namespace WebCore {
@@ -42,14 +43,18 @@
class NodeList;
class QualifiedName;
-class MutationRecord : public RefCounted<MutationRecord> {
+class MutationRecord : public RefCounted<MutationRecord>, public ScriptWrappable {
public:
static PassRefPtr<MutationRecord> createChildList(PassRefPtr<Node> target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling);
static PassRefPtr<MutationRecord> createAttributes(PassRefPtr<Node> target, const QualifiedName&, const AtomicString& oldValue);
static PassRefPtr<MutationRecord> createCharacterData(PassRefPtr<Node> target, const String& oldValue);
-
static PassRefPtr<MutationRecord> createWithNullOldValue(PassRefPtr<MutationRecord>);
+ MutationRecord()
+ {
+ ScriptWrappable::init(this);
+ }
+
virtual ~MutationRecord();
virtual const AtomicString& type() = 0;
diff --git a/Source/core/dom/MutationRecord.idl b/Source/core/dom/MutationRecord.idl
index 2002d1d..c3ef616 100644
--- a/Source/core/dom/MutationRecord.idl
+++ b/Source/core/dom/MutationRecord.idl
@@ -29,7 +29,6 @@
*/
[
- SkipVTableValidation
] interface MutationRecord {
readonly attribute DOMString type;
readonly attribute Node target;
diff --git a/Source/core/dom/NameNodeList.cpp b/Source/core/dom/NameNodeList.cpp
index 2323d75..19aadbb 100644
--- a/Source/core/dom/NameNodeList.cpp
+++ b/Source/core/dom/NameNodeList.cpp
@@ -23,7 +23,6 @@
#include "config.h"
#include "core/dom/NameNodeList.h"
-#include "HTMLNames.h"
#include "core/dom/Element.h"
#include "core/dom/NodeRareData.h"
#include <wtf/Assertions.h>
diff --git a/Source/core/dom/NamedFlow.cpp b/Source/core/dom/NamedFlow.cpp
index 871c633..6f6d936 100644
--- a/Source/core/dom/NamedFlow.cpp
+++ b/Source/core/dom/NamedFlow.cpp
@@ -47,6 +47,7 @@
, m_parentFlowThread(0)
{
ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled());
+ ScriptWrappable::init(this);
}
NamedFlow::~NamedFlow()
diff --git a/Source/core/dom/NamedFlow.h b/Source/core/dom/NamedFlow.h
index 8cf206e..060a3ff 100644
--- a/Source/core/dom/NamedFlow.h
+++ b/Source/core/dom/NamedFlow.h
@@ -30,12 +30,12 @@
#ifndef NamedFlow_h
#define NamedFlow_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/EventTarget.h"
-
-#include <wtf/ListHashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicString.h>
+#include "wtf/ListHashSet.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
namespace WebCore {
@@ -46,7 +46,7 @@
class RenderNamedFlowThread;
class ScriptExecutionContext;
-class NamedFlow : public RefCounted<NamedFlow>, public EventTarget {
+class NamedFlow : public RefCounted<NamedFlow>, public ScriptWrappable, public EventTarget {
public:
static PassRefPtr<NamedFlow> create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName);
diff --git a/Source/core/dom/NamedFlow.idl b/Source/core/dom/NamedFlow.idl
index c95891f..ae2cfeb 100644
--- a/Source/core/dom/NamedFlow.idl
+++ b/Source/core/dom/NamedFlow.idl
@@ -32,7 +32,7 @@
EnabledAtRuntime=cssRegions,
EventTarget,
InterfaceName=WebKitNamedFlow,
- GenerateIsReachable=ImplOwnerNodeRoot
+ GenerateIsReachable=ownerNode
] interface NamedFlow {
readonly attribute DOMString name;
readonly attribute boolean overset;
diff --git a/Source/core/dom/NamedNodeMap.cpp b/Source/core/dom/NamedNodeMap.cpp
index 98bddb5..5e054e7 100644
--- a/Source/core/dom/NamedNodeMap.cpp
+++ b/Source/core/dom/NamedNodeMap.cpp
@@ -25,7 +25,6 @@
#include "config.h"
#include "core/dom/NamedNodeMap.h"
-#include "HTMLNames.h"
#include "core/dom/Attr.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
diff --git a/Source/core/dom/NamedNodeMap.idl b/Source/core/dom/NamedNodeMap.idl
index 070beb3..0613357 100644
--- a/Source/core/dom/NamedNodeMap.idl
+++ b/Source/core/dom/NamedNodeMap.idl
@@ -19,8 +19,7 @@
*/
[
- GenerateIsReachable=ImplElementRoot,
- ImplementationLacksVTable
+ GenerateIsReachable=element
] interface NamedNodeMap {
getter Node getNamedItem([Default=Undefined] optional DOMString name);
diff --git a/Source/core/dom/NamedNodesCollection.cpp b/Source/core/dom/NamedNodesCollection.cpp
new file mode 100644
index 0000000..51fac3c
--- /dev/null
+++ b/Source/core/dom/NamedNodesCollection.cpp
@@ -0,0 +1,55 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "core/dom/NamedNodesCollection.h"
+
+#include "core/dom/Element.h"
+#include "core/dom/NamedNodeMap.h"
+
+namespace WebCore {
+
+Node* NamedNodesCollection::item(unsigned index) const
+{
+ if (index < m_nodes.size())
+ return m_nodes[index].get();
+ return 0;
+}
+
+Node* NamedNodesCollection::namedItem(const AtomicString& id) const
+{
+ for (unsigned i = 0; i < m_nodes.size(); ++i) {
+ Node* node = m_nodes[i].get();
+ if (node->hasID() && toElement(node)->getIdAttribute() == id)
+ return node;
+ }
+ return 0;
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/NamedNodesCollection.h b/Source/core/dom/NamedNodesCollection.h
new file mode 100644
index 0000000..54839b5
--- /dev/null
+++ b/Source/core/dom/NamedNodesCollection.h
@@ -0,0 +1,62 @@
+/*
+* Copyright (C) 2009 Google Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following disclaimer
+* in the documentation and/or other materials provided with the
+* distribution.
+* * Neither the name of Google Inc. nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef NamedNodesCollection_h
+#define NamedNodesCollection_h
+
+#include "core/dom/Node.h"
+#include "core/dom/NodeList.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class NamedNodesCollection : public NodeList {
+public:
+ static PassRefPtr<NodeList> create(const Vector<RefPtr<Node> >& nodes)
+ {
+ return adoptRef(new NamedNodesCollection(nodes));
+ }
+
+ virtual unsigned length() const OVERRIDE { return m_nodes.size(); }
+ virtual Node* item(unsigned) const OVERRIDE;
+ virtual Node* namedItem(const AtomicString&) const OVERRIDE;
+
+private:
+ explicit NamedNodesCollection(const Vector<RefPtr<Node> >& nodes)
+ : m_nodes(nodes) { }
+
+ Vector<RefPtr<Node> > m_nodes;
+};
+
+} // namespace WebCore
+
+#endif // NamedNodesCollection_h
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 3223aa7..259dd85 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -666,7 +666,7 @@
}
}
-const AtomicString& Node::virtualPrefix() const
+const AtomicString& Node::prefix() const
{
// For nodes other than elements and attributes, the prefix is always null
return nullAtom;
@@ -680,12 +680,12 @@
ec = NAMESPACE_ERR;
}
-const AtomicString& Node::virtualLocalName() const
+const AtomicString& Node::localName() const
{
return nullAtom;
}
-const AtomicString& Node::virtualNamespaceURI() const
+const AtomicString& Node::namespaceURI() const
{
return nullAtom;
}
@@ -865,15 +865,19 @@
markAncestorsWithChildNeedsStyleRecalc();
}
-void Node::lazyAttach(ShouldSetAttached shouldSetAttached)
+void Node::lazyAttach()
{
- for (Node* n = this; n; n = NodeTraversal::next(n, this)) {
- if (n->hasChildNodes())
- n->setChildNeedsStyleRecalc();
- n->setStyleChange(FullStyleChange);
- if (shouldSetAttached == SetAttached)
- n->setAttached();
+ // It's safe to synchronously attach here because we're in the middle of style recalc
+ // while it's not safe to mark nodes as needing style recalc except in the loop in
+ // Element::recalcStyle because we may mark an ancestor as not needing recalc and
+ // then the node would never get updated. One place this currently happens is
+ // HTMLObjectElement::renderFallbackContent which may call lazyAttach from inside
+ // attach which was triggered by a recalcStyle.
+ if (document()->inStyleRecalc()) {
+ attach();
+ return;
}
+ setStyleChange(FullStyleChange);
markAncestorsWithChildNeedsStyleRecalc();
}
@@ -1032,7 +1036,7 @@
if (!other || !other->hasChildNodes() || inDocument() != other->inDocument())
return false;
if (other->isDocumentNode())
- return document() == other && !isDocumentNode() && inDocument();
+ return document() == other && !isDocumentNode() && inDocument() && !isInShadowTree();
for (const ContainerNode* n = parentNode(); n; n = n->parentNode()) {
if (n == other)
return true;
@@ -1072,7 +1076,7 @@
void Node::attach()
{
ASSERT(!attached());
- ASSERT(!renderer() || (renderer()->style() && renderer()->parent()));
+ ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || renderer()->isRenderView())));
// If this node got a renderer it may be the previousRenderer() of sibling text nodes and thus affect the
// result of Text::textRendererIsNeeded() for those nodes.
@@ -2170,10 +2174,8 @@
document()->didAddWheelEventHandler();
}
- Vector<AtomicString> touchEventNames = eventNames().touchEventNames();
- for (size_t i = 0; i < touchEventNames.size(); ++i) {
- const EventListenerVector& listeners = getEventListeners(touchEventNames[i]);
- for (size_t j = 0; j < listeners.size(); ++j) {
+ if (const TouchEventTargetSet* touchHandlers = oldDocument ? oldDocument->touchEventTargets() : 0) {
+ while (touchHandlers->contains(this)) {
oldDocument->didRemoveTouchEventHandler(this);
document()->didAddTouchEventHandler(this);
}
diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h
index b571f9c..234e8ba 100644
--- a/Source/core/dom/Node.h
+++ b/Source/core/dom/Node.h
@@ -210,9 +210,9 @@
bool hasChildNodes() const { return firstChild(); }
virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
- const AtomicString& localName() const { return virtualLocalName(); }
- const AtomicString& namespaceURI() const { return virtualNamespaceURI(); }
- const AtomicString& prefix() const { return virtualPrefix(); }
+ virtual const AtomicString& localName() const;
+ virtual const AtomicString& namespaceURI() const;
+ virtual const AtomicString& prefix() const;
virtual void setPrefix(const AtomicString&, ExceptionCode&);
void normalize();
@@ -375,7 +375,6 @@
void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange);
void clearNeedsStyleRecalc() { m_nodeFlags &= ~StyleChangeMask; }
- virtual void scheduleSetNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange) { setNeedsStyleRecalc(changeType); }
void setIsLink(bool f) { setFlag(f, IsLinkFlag); }
void setIsLink() { setFlag(IsLinkFlag); }
@@ -393,12 +392,8 @@
bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuringMinorGCFlag); }
void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableDuringMinorGCFlag); }
- enum ShouldSetAttached {
- SetAttached,
- DoNotSetAttached
- };
- void lazyAttach(ShouldSetAttached = SetAttached);
- void lazyReattach(ShouldSetAttached = SetAttached);
+ void lazyAttach();
+ void lazyReattach();
virtual void setFocus(bool flag);
virtual void setActive(bool flag = true, bool pause = false);
@@ -541,7 +536,7 @@
#endif
void reattach();
- void reattachIfAttached();
+ void lazyReattachIfAttached();
ContainerNode* parentNodeForRenderingAndStyle();
// Wrapper for nodes that don't have a renderer, but still cache the style (like HTMLOptionElement).
@@ -708,9 +703,7 @@
// These bits are used by derived classes, pulled up here so they can
// be stored in the same memory word as the Node bits above.
IsParsingChildrenFinishedFlag = 1 << 13, // Element
-#if ENABLE(SVG)
HasSVGRareDataFlag = 1 << 14, // SVGElement
-#endif
StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
@@ -804,9 +797,6 @@
virtual RenderStyle* nonRendererStyle() const { return 0; }
- virtual const AtomicString& virtualPrefix() const;
- virtual const AtomicString& virtualLocalName() const;
- virtual const AtomicString& virtualNamespaceURI() const;
virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO);
Element* ancestorElement() const;
@@ -833,11 +823,9 @@
void setIsParsingChildrenFinished() { setFlag(IsParsingChildrenFinishedFlag); }
void clearIsParsingChildrenFinished() { clearFlag(IsParsingChildrenFinishedFlag); }
-#if ENABLE(SVG)
bool hasSVGRareData() const { return getFlag(HasSVGRareDataFlag); }
void setHasSVGRareData() { setFlag(HasSVGRareDataFlag); }
void clearHasSVGRareData() { clearFlag(HasSVGRareDataFlag); }
-#endif
};
// Used in Node::addSubresourceAttributeURLs() and in addSubresourceStyleURLs()
@@ -877,17 +865,17 @@
attach();
}
-inline void Node::reattachIfAttached()
+inline void Node::lazyReattachIfAttached()
{
if (attached())
- reattach();
+ lazyReattach();
}
-inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached)
+inline void Node::lazyReattach()
{
if (attached())
detach();
- lazyAttach(shouldSetAttached);
+ lazyAttach();
}
// Need a template since ElementShadow is not a Node, but has the style recalc methods.
diff --git a/Source/core/dom/NodeFilter.cpp b/Source/core/dom/NodeFilter.cpp
index 5667ea4..6fedc7a 100644
--- a/Source/core/dom/NodeFilter.cpp
+++ b/Source/core/dom/NodeFilter.cpp
@@ -25,8 +25,6 @@
#include "config.h"
#include "core/dom/NodeFilter.h"
-#include "core/dom/Node.h"
-
namespace WebCore {
short NodeFilter::acceptNode(ScriptState* state, Node* node) const
diff --git a/Source/core/dom/NodeFilter.h b/Source/core/dom/NodeFilter.h
index 8866ba6..c720126 100644
--- a/Source/core/dom/NodeFilter.h
+++ b/Source/core/dom/NodeFilter.h
@@ -25,64 +25,72 @@
#ifndef NodeFilter_h
#define NodeFilter_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/NodeFilterCondition.h"
-#include <wtf/RefPtr.h>
+#include "wtf/RefPtr.h"
namespace WebCore {
- class NodeFilter : public RefCounted<NodeFilter> {
- public:
- /**
- * The following constants are returned by the acceptNode()
- * method:
- */
- enum {
- FILTER_ACCEPT = 1,
- FILTER_REJECT = 2,
- FILTER_SKIP = 3
- };
-
- /**
- * These are the available values for the whatToShow parameter.
- * They are the same as the set of possible types for Node, and
- * their values are derived by using a bit position corresponding
- * to the value of NodeType for the equivalent node type.
- */
- enum {
- SHOW_ALL = 0xFFFFFFFF,
- SHOW_ELEMENT = 0x00000001,
- SHOW_ATTRIBUTE = 0x00000002,
- SHOW_TEXT = 0x00000004,
- SHOW_CDATA_SECTION = 0x00000008,
- SHOW_ENTITY_REFERENCE = 0x00000010,
- SHOW_ENTITY = 0x00000020,
- SHOW_PROCESSING_INSTRUCTION = 0x00000040,
- SHOW_COMMENT = 0x00000080,
- SHOW_DOCUMENT = 0x00000100,
- SHOW_DOCUMENT_TYPE = 0x00000200,
- SHOW_DOCUMENT_FRAGMENT = 0x00000400,
- SHOW_NOTATION = 0x00000800
- };
-
- static PassRefPtr<NodeFilter> create(PassRefPtr<NodeFilterCondition> condition)
- {
- return adoptRef(new NodeFilter(condition));
- }
-
- static PassRefPtr<NodeFilter> create()
- {
- return adoptRef(new NodeFilter());
- }
-
- short acceptNode(ScriptState*, Node*) const;
-
- private:
- explicit NodeFilter(PassRefPtr<NodeFilterCondition> condition) : m_condition(condition) { }
- NodeFilter() {}
-
- RefPtr<NodeFilterCondition> m_condition;
+class NodeFilter : public RefCounted<NodeFilter>, public ScriptWrappable {
+public:
+ /**
+ * The following constants are returned by the acceptNode()
+ * method:
+ */
+ enum {
+ FILTER_ACCEPT = 1,
+ FILTER_REJECT = 2,
+ FILTER_SKIP = 3
};
+ /**
+ * These are the available values for the whatToShow parameter.
+ * They are the same as the set of possible types for Node, and
+ * their values are derived by using a bit position corresponding
+ * to the value of NodeType for the equivalent node type.
+ */
+ enum {
+ SHOW_ALL = 0xFFFFFFFF,
+ SHOW_ELEMENT = 0x00000001,
+ SHOW_ATTRIBUTE = 0x00000002,
+ SHOW_TEXT = 0x00000004,
+ SHOW_CDATA_SECTION = 0x00000008,
+ SHOW_ENTITY_REFERENCE = 0x00000010,
+ SHOW_ENTITY = 0x00000020,
+ SHOW_PROCESSING_INSTRUCTION = 0x00000040,
+ SHOW_COMMENT = 0x00000080,
+ SHOW_DOCUMENT = 0x00000100,
+ SHOW_DOCUMENT_TYPE = 0x00000200,
+ SHOW_DOCUMENT_FRAGMENT = 0x00000400,
+ SHOW_NOTATION = 0x00000800
+ };
+
+ static PassRefPtr<NodeFilter> create(PassRefPtr<NodeFilterCondition> condition)
+ {
+ return adoptRef(new NodeFilter(condition));
+ }
+
+ static PassRefPtr<NodeFilter> create()
+ {
+ return adoptRef(new NodeFilter());
+ }
+
+ short acceptNode(ScriptState*, Node*) const;
+
+private:
+ explicit NodeFilter(PassRefPtr<NodeFilterCondition> condition) : m_condition(condition)
+ {
+ ScriptWrappable::init(this);
+ }
+
+ NodeFilter()
+ {
+ ScriptWrappable::init(this);
+ }
+
+ RefPtr<NodeFilterCondition> m_condition;
+};
+
} // namespace WebCore
#endif // NodeFilter_h
diff --git a/Source/core/dom/NodeFilter.idl b/Source/core/dom/NodeFilter.idl
index b42757c..989099f 100644
--- a/Source/core/dom/NodeFilter.idl
+++ b/Source/core/dom/NodeFilter.idl
@@ -19,7 +19,6 @@
*/
[
- ImplementationLacksVTable
] interface NodeFilter {
// Constants returned by acceptNode
const short FILTER_ACCEPT = 1;
diff --git a/Source/core/dom/NodeIterator.idl b/Source/core/dom/NodeIterator.idl
index e22c8fa..b019d76 100644
--- a/Source/core/dom/NodeIterator.idl
+++ b/Source/core/dom/NodeIterator.idl
@@ -20,8 +20,7 @@
// Introduced in DOM Level 2:
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface NodeIterator {
readonly attribute Node root;
readonly attribute unsigned long whatToShow;
diff --git a/Source/core/dom/NodeList.cpp b/Source/core/dom/NodeList.cpp
new file mode 100644
index 0000000..fb06c70
--- /dev/null
+++ b/Source/core/dom/NodeList.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "core/dom/NodeList.h"
+
+#include "core/dom/Node.h"
+
+namespace WebCore {
+
+void NodeList::anonymousNamedGetter(const AtomicString& name, bool& returnValue0Enabled, RefPtr<Node>& returnValue0, bool& returnValue1Enabled, unsigned& returnValue1)
+{
+ // Length property cannot be overridden.
+ DEFINE_STATIC_LOCAL(const AtomicString, length, ("length", AtomicString::ConstructFromLiteral));
+ if (name == length) {
+ returnValue1Enabled = true;
+ returnValue1 = this->length();
+ return;
+ }
+
+ Node* result = namedItem(name);
+ if (!result)
+ return;
+
+ returnValue0Enabled = true;
+ returnValue0 = result;
+}
+
+
+} // namespace WebCore
diff --git a/Source/core/dom/NodeList.h b/Source/core/dom/NodeList.h
index 48cb063..c47182c 100644
--- a/Source/core/dom/NodeList.h
+++ b/Source/core/dom/NodeList.h
@@ -43,6 +43,7 @@
// Other methods (not part of DOM)
virtual bool isLiveNodeList() const { return false; }
+ void anonymousNamedGetter(const AtomicString&, bool&, RefPtr<Node>&, bool&, unsigned&);
protected:
NodeList()
diff --git a/Source/core/dom/NodeList.idl b/Source/core/dom/NodeList.idl
index 02bf971..cc30450 100644
--- a/Source/core/dom/NodeList.idl
+++ b/Source/core/dom/NodeList.idl
@@ -20,12 +20,11 @@
[
CustomIsReachable,
- CustomNamedGetter,
- DependentLifetime,
- SkipVTableValidation
+ DependentLifetime
] interface NodeList {
getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
+ [ImplementedAs=anonymousNamedGetter, OverrideBuiltins] getter (Node or unsigned long) (DOMString name);
readonly attribute unsigned long length;
diff --git a/Source/core/dom/NodeRenderingContext.cpp b/Source/core/dom/NodeRenderingContext.cpp
index 1533f0a..41c6ce0 100644
--- a/Source/core/dom/NodeRenderingContext.cpp
+++ b/Source/core/dom/NodeRenderingContext.cpp
@@ -27,6 +27,7 @@
#include "core/dom/NodeRenderingContext.h"
#include "HTMLNames.h"
+#include "SVGNames.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/ContainerNode.h"
#include "core/dom/Node.h"
@@ -46,10 +47,6 @@
#include "core/rendering/RenderView.h"
#include "core/rendering/style/StyleInheritedData.h"
-#if ENABLE(SVG)
-#include "SVGNames.h"
-#endif
-
namespace WebCore {
using namespace HTMLNames;
@@ -213,12 +210,10 @@
if (document->webkitIsFullScreen() && document->webkitCurrentFullScreenElement() == m_node)
return;
-#if ENABLE(SVG)
// Allow only svg root elements to be directly collected by a render flow thread.
if (m_node->isSVGElement()
&& (!(m_node->hasTagName(SVGNames::svgTag) && m_node->parentNode() && !m_node->parentNode()->isSVGElement())))
return;
-#endif
m_flowThread = m_style->flowThread();
ASSERT(m_node->document()->renderView());
@@ -260,6 +255,7 @@
RenderObject* newRenderer = element->createRenderer(document->renderArena(), m_style.get());
if (!newRenderer)
return;
+
if (!parentRenderer->isChildAllowed(newRenderer, m_style.get())) {
newRenderer->destroy();
return;
diff --git a/Source/core/dom/Notation.cpp b/Source/core/dom/Notation.cpp
index ee4befd..074801d 100644
--- a/Source/core/dom/Notation.cpp
+++ b/Source/core/dom/Notation.cpp
@@ -21,8 +21,6 @@
#include "config.h"
#include "core/dom/Notation.h"
-#include "core/dom/Document.h"
-
namespace WebCore {
Notation::Notation(Document* document, const String& name, const String& publicId, const String& systemId)
diff --git a/Source/core/dom/PopStateEvent.idl b/Source/core/dom/PopStateEvent.idl
index c4153f6..709777f 100644
--- a/Source/core/dom/PopStateEvent.idl
+++ b/Source/core/dom/PopStateEvent.idl
@@ -27,5 +27,5 @@
[
ConstructorTemplate=Event
] interface PopStateEvent : Event {
- [InitializedByEventConstructor, CachedAttribute, CustomGetter] readonly attribute any state;
+ [InitializedByEventConstructor, CustomGetter] readonly attribute any state;
};
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index d65ca0f..7e5d25e 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -26,13 +26,11 @@
#include "core/css/StyleSheetContents.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentStyleSheetCollection.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/loader/FrameLoader.h"
#include "core/loader/cache/CachedCSSStyleSheet.h"
#include "core/loader/cache/CachedResourceLoader.h"
#include "core/loader/cache/CachedResourceRequest.h"
+#include "core/loader/cache/CachedResourceRequestInitiators.h"
#include "core/loader/cache/CachedXSLStyleSheet.h"
-#include "core/page/Frame.h"
#include "core/xml/XSLStyleSheet.h"
#include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes()
@@ -156,7 +154,7 @@
m_loading = true;
document()->styleSheetCollection()->addPendingSheet();
- CachedResourceRequest request(ResourceRequest(document()->completeURL(href)));
+ CachedResourceRequest request(ResourceRequest(document()->completeURL(href)), cachedResourceRequestInitiators().processinginstruction);
if (m_isXSL)
m_cachedSheet = document()->cachedResourceLoader()->requestXSLStyleSheet(request);
else
diff --git a/Source/core/dom/PseudoElement.cpp b/Source/core/dom/PseudoElement.cpp
index 269d884..225ac0a 100644
--- a/Source/core/dom/PseudoElement.cpp
+++ b/Source/core/dom/PseudoElement.cpp
@@ -112,8 +112,8 @@
// the style propagated downward manually similar to RenderObject::propagateStyleToAnonymousChildren.
RenderObject* renderer = this->renderer();
for (RenderObject* child = renderer->nextInPreOrder(renderer); child; child = child->nextInPreOrder(renderer)) {
- // We only manage the style for the generated content which must be images or text.
- if (!child->isText() && !child->isImage())
+ // We only manage the style for the generated content items.
+ if (!child->isText() && !child->isQuote() && !child->isImage())
continue;
// The style for the RenderTextFragment for first letter is managed by an enclosing block, not by us.
diff --git a/Source/core/dom/QualifiedName.cpp b/Source/core/dom/QualifiedName.cpp
index d0228de..2cfc882 100644
--- a/Source/core/dom/QualifiedName.cpp
+++ b/Source/core/dom/QualifiedName.cpp
@@ -26,6 +26,7 @@
#endif
#include "HTMLNames.h"
+#include "SVGNames.h"
#include "XLinkNames.h"
#include "XMLNSNames.h"
#include "XMLNames.h"
@@ -35,16 +36,10 @@
#include <wtf/HashSet.h>
#include <wtf/StaticConstructors.h>
-#if ENABLE(SVG)
-#include "SVGNames.h"
-#endif
-
namespace WebCore {
static const int staticQualifiedNamesCount = HTMLNames::HTMLTagsCount + HTMLNames::HTMLAttrsCount
-#if ENABLE(SVG)
+ SVGNames::SVGTagsCount + SVGNames::SVGAttrsCount
-#endif
+ XLinkNames::XLinkAttrsCount
+ XMLNSNames::XMLNSAttrsCount
+ XMLNames::XMLAttrsCount;
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 311660d..7817efd 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -26,7 +26,6 @@
#include "core/dom/Range.h"
#include <stdio.h>
-#include "HTMLNames.h"
#include "core/dom/ClientRect.h"
#include "core/dom/ClientRectList.h"
#include "core/dom/DocumentFragment.h"
@@ -35,16 +34,13 @@
#include "core/dom/NodeTraversal.h"
#include "core/dom/NodeWithIndex.h"
#include "core/dom/ProcessingInstruction.h"
+#include "core/dom/ScopedEventQueue.h"
#include "core/dom/Text.h"
#include "core/editing/TextIterator.h"
#include "core/editing/VisiblePosition.h"
#include "core/editing/VisibleUnits.h"
-#include "core/editing/htmlediting.h"
#include "core/editing/markup.h"
#include "core/html/HTMLElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/page/Page.h"
#include "core/platform/graphics/FloatQuad.h"
#include "core/rendering/RenderBoxModelObject.h"
#include "core/rendering/RenderText.h"
@@ -69,6 +65,7 @@
rangeCounter.increment();
#endif
+ ScriptWrappable::init(this);
m_ownerDocument->attachRange(this);
}
@@ -86,6 +83,7 @@
rangeCounter.increment();
#endif
+ ScriptWrappable::init(this);
m_ownerDocument->attachRange(this);
// Simply setting the containers and offsets directly would not do any of the checking
@@ -1016,6 +1014,7 @@
break;
}
+ EventQueueScope scope;
bool collapsed = m_start == m_end;
RefPtr<Node> container;
if (startIsText) {
@@ -1029,8 +1028,6 @@
if (ec)
return;
- // This special case doesn't seem to match the DOM specification, but it's currently required
- // to pass Acid3. We might later decide to remove this.
if (collapsed)
m_end.setToBeforeChild(newText.get());
} else {
@@ -1044,8 +1041,6 @@
if (ec)
return;
- // This special case doesn't seem to match the DOM specification, but it's currently required
- // to pass Acid3. We might later decide to remove this.
if (collapsed && numNewChildren)
m_end.set(m_start.container(), startOffset + numNewChildren, lastChild.get());
}
@@ -1807,11 +1802,7 @@
unsigned boundaryOffset = boundary.offset();
if (boundaryOffset <= oldNode->length())
return;
- Node* next = oldNode->nextSibling();
- if (!next || !next->isTextNode())
- boundary.set(oldNode, oldNode->length(), 0);
- else
- boundary.set(next, std::min(boundaryOffset - oldNode->length(), toText(next)->length()), 0);
+ boundary.set(oldNode->nextSibling(), boundaryOffset - oldNode->length(), 0);
}
void Range::textNodeSplit(Text* oldNode)
@@ -1820,6 +1811,8 @@
ASSERT(oldNode->document() == m_ownerDocument);
ASSERT(oldNode->parentNode());
ASSERT(oldNode->isTextNode());
+ ASSERT(oldNode->nextSibling());
+ ASSERT(oldNode->nextSibling()->isTextNode());
boundaryTextNodesSplit(m_start, oldNode);
boundaryTextNodesSplit(m_end, oldNode);
}
diff --git a/Source/core/dom/Range.h b/Source/core/dom/Range.h
index dfc33ec..0df40c2 100644
--- a/Source/core/dom/Range.h
+++ b/Source/core/dom/Range.h
@@ -25,6 +25,7 @@
#ifndef Range_h
#define Range_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/ExceptionCodePlaceholder.h"
#include "core/dom/FragmentScriptingPermission.h"
#include "core/dom/RangeBoundaryPoint.h"
@@ -46,7 +47,7 @@
class NodeWithIndex;
class Text;
-class Range : public RefCounted<Range> {
+class Range : public RefCounted<Range>, public ScriptWrappable {
public:
static PassRefPtr<Range> create(PassRefPtr<Document>);
static PassRefPtr<Range> create(PassRefPtr<Document>, PassRefPtr<Node> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffset);
diff --git a/Source/core/dom/Range.idl b/Source/core/dom/Range.idl
index 2d825b1..f816069 100644
--- a/Source/core/dom/Range.idl
+++ b/Source/core/dom/Range.idl
@@ -21,8 +21,7 @@
// Introduced in DOM Level 2:
[
Constructor,
- CallWith=ScriptExecutionContext,
- ImplementationLacksVTable,
+ CallWith=ScriptExecutionContext
] interface Range {
[GetterRaisesException] readonly attribute Node startContainer;
diff --git a/Source/core/dom/ScriptElement.cpp b/Source/core/dom/ScriptElement.cpp
index 6b58738..d51656c 100644
--- a/Source/core/dom/ScriptElement.cpp
+++ b/Source/core/dom/ScriptElement.cpp
@@ -24,16 +24,11 @@
#include "config.h"
#include "core/dom/ScriptElement.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/text/StringHash.h>
-#include <wtf/text/TextPosition.h>
#include "HTMLNames.h"
+#include "SVGNames.h"
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptSourceCode.h"
-#include "bindings/v8/ScriptValue.h"
#include "core/dom/Document.h"
-#include "core/dom/DocumentParser.h"
#include "core/dom/Event.h"
#include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
#include "core/dom/ScriptRunner.h"
@@ -41,23 +36,19 @@
#include "core/dom/Text.h"
#include "core/html/HTMLScriptElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
-#include "core/inspector/ScriptCallStack.h"
#include "core/loader/CrossOriginAccessControl.h"
-#include "core/loader/FrameLoader.h"
#include "core/loader/cache/CachedResourceLoader.h"
#include "core/loader/cache/CachedResourceRequest.h"
#include "core/loader/cache/CachedScript.h"
#include "core/page/ContentSecurityPolicy.h"
#include "core/page/Frame.h"
-#include "core/page/Page.h"
-#include "core/page/Settings.h"
#include "core/platform/MIMETypeRegistry.h"
-#include "weborigin/SecurityOrigin.h"
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/svg/SVGScriptElement.h"
-#endif
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/StringHash.h"
+#include "wtf/text/TextPosition.h"
namespace WebCore {
@@ -241,7 +232,8 @@
} else {
// Reset line numbering for nested writes.
TextPosition position = document->isInDocumentWrite() ? TextPosition() : scriptStartPosition;
- executeScript(ScriptSourceCode(scriptContent(), document->url(), position));
+ KURL scriptURL = (!document->isInDocumentWrite() && m_parserInserted) ? document->url() : KURL();
+ executeScript(ScriptSourceCode(scriptContent(), scriptURL, position));
}
return true;
@@ -254,12 +246,10 @@
return false;
if (!m_element->inDocument() || m_element->document() != originalDocument)
return false;
- if (!m_element->document()->contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr), m_element->document()->url(), m_startLineNumber, m_element->document()->completeURL(sourceUrl)))
- return false;
ASSERT(!m_cachedScript);
if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
- CachedResourceRequest request(ResourceRequest(m_element->document()->completeURL(sourceUrl)));
+ CachedResourceRequest request(ResourceRequest(m_element->document()->completeURL(sourceUrl)), element()->localName());
String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
if (!crossOriginMode.isNull()) {
@@ -268,7 +258,10 @@
updateRequestForAccessControl(request.mutableResourceRequest(), m_element->document()->securityOrigin(), allowCredentials);
}
request.setCharset(scriptCharset());
- request.setInitiator(element());
+
+ bool isValidScriptNonce = m_element->document()->contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
+ if (isValidScriptNonce)
+ request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request);
m_isExternalScript = true;
@@ -292,9 +285,7 @@
RefPtr<Document> document = m_element->document();
Frame* frame = document->frame();
- bool shouldBypassMainWorldContentSecurityPolicy = (frame && frame->script()->shouldBypassMainWorldContentSecurityPolicy());
- if (!shouldBypassMainWorldContentSecurityPolicy && !document->contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr), document->url(), m_startLineNumber))
- return;
+ bool shouldBypassMainWorldContentSecurityPolicy = (frame && frame->script()->shouldBypassMainWorldContentSecurityPolicy()) || document->contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && !document->contentSecurityPolicy()->allowInlineScript(document->url(), m_startLineNumber)))
return;
@@ -310,7 +301,7 @@
// Create a script from the script element node, using the script
// block's source and the script block's type.
// Note: This is where the script is compiled and actually executed.
- frame->script()->evaluate(sourceCode);
+ frame->script()->executeScriptInMainWorld(sourceCode);
}
}
}
@@ -420,10 +411,8 @@
if (element->isHTMLElement() && element->hasTagName(HTMLNames::scriptTag))
return static_cast<HTMLScriptElement*>(element);
-#if ENABLE(SVG)
if (element->isSVGElement() && element->hasTagName(SVGNames::scriptTag))
return static_cast<SVGScriptElement*>(element);
-#endif
return 0;
}
diff --git a/Source/core/dom/ScriptExecutionContext.cpp b/Source/core/dom/ScriptExecutionContext.cpp
index 5ca4d36..9d79d79 100644
--- a/Source/core/dom/ScriptExecutionContext.cpp
+++ b/Source/core/dom/ScriptExecutionContext.cpp
@@ -143,7 +143,7 @@
{
ASSERT(port);
ASSERT((isDocument() && isMainThread())
- || (isWorkerContext() && currentThread() == static_cast<WorkerContext*>(this)->thread()->threadID()));
+ || (isWorkerContext() && static_cast<WorkerContext*>(this)->thread()->isCurrentThread()));
m_messagePorts.add(port);
}
@@ -152,7 +152,7 @@
{
ASSERT(port);
ASSERT((isDocument() && isMainThread())
- || (isWorkerContext() && currentThread() == static_cast<WorkerContext*>(this)->thread()->threadID()));
+ || (isWorkerContext() && static_cast<WorkerContext*>(this)->thread()->isCurrentThread()));
m_messagePorts.remove(port);
}
diff --git a/Source/core/dom/ScriptableDocumentParser.cpp b/Source/core/dom/ScriptableDocumentParser.cpp
index 42da5b5..504e6f3 100644
--- a/Source/core/dom/ScriptableDocumentParser.cpp
+++ b/Source/core/dom/ScriptableDocumentParser.cpp
@@ -26,9 +26,7 @@
#include "config.h"
#include "core/dom/ScriptableDocumentParser.h"
-#include "bindings/v8/ScriptController.h"
#include "core/dom/Document.h"
-#include "core/page/Frame.h"
#include "core/page/Settings.h"
namespace WebCore {
diff --git a/Source/core/dom/SecurityPolicyViolationEvent.idl b/Source/core/dom/SecurityPolicyViolationEvent.idl
index aae2f7e..b214e6f 100644
--- a/Source/core/dom/SecurityPolicyViolationEvent.idl
+++ b/Source/core/dom/SecurityPolicyViolationEvent.idl
@@ -24,7 +24,7 @@
[
NoInterfaceObject,
- ConstructorTemplate=Event,
+ ConstructorTemplate=Event
] interface SecurityPolicyViolationEvent : Event {
[InitializedByEventConstructor] readonly attribute DOMString documentURI;
[InitializedByEventConstructor] readonly attribute DOMString referrer;
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index 589a0f2..aa06b05 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -33,7 +33,6 @@
#include "core/css/SiblingTraversalStrategies.h"
#include "core/dom/Document.h"
#include "core/dom/StaticNodeList.h"
-#include "core/dom/StyledElement.h"
namespace WebCore {
@@ -98,38 +97,67 @@
return toElement(result.first().get());
}
-bool SelectorDataList::canUseIdLookup(Node* rootNode) const
-{
- // We need to return the matches in document order. To use id lookup while there is possiblity of multiple matches
- // we would need to sort the results. For now, just traverse the document in that case.
- if (m_selectors.size() != 1)
- return false;
- if (m_selectors[0].selector->m_match != CSSSelector::Id)
- return false;
- if (!rootNode->inDocument())
- return false;
- if (rootNode->document()->inQuirksMode())
- return false;
- if (rootNode->document()->containsMultipleElementsWithId(m_selectors[0].selector->value()))
- return false;
- return true;
-}
-
static inline bool isTreeScopeRoot(Node* node)
{
ASSERT(node);
return node->isDocumentNode() || node->isShadowRoot();
}
+// If the first pair value is true, the returned Node is the single Element that may match the selector query.
+//
+// If the first value is false, the returned Node is the rootNode parameter or a descendant of rootNode representing
+// the subtree for which we can limit the querySelector traversal.
+//
+// The returned Node may be 0, regardless of the returned bool value, if this method finds that the selectors won't
+// match any element.
+std::pair<bool, Node*> SelectorDataList::findTraverseRoot(Node* rootNode) const
+{
+ // We need to return the matches in document order. To use id lookup while there is possiblity of multiple matches
+ // we would need to sort the results. For now, just traverse the document in that case.
+ if (m_selectors.size() != 1)
+ return std::make_pair(false, rootNode);
+ if (!rootNode->inDocument())
+ return std::make_pair(false, rootNode);
+ if (rootNode->document()->inQuirksMode())
+ return std::make_pair(false, rootNode);
+
+ bool matchSingleNode = true;
+ bool startFromParent = false;
+ for (const CSSSelector* selector = m_selectors[0].selector; selector; selector = selector->tagHistory()) {
+ if (selector->m_match == CSSSelector::Id && !rootNode->document()->containsMultipleElementsWithId(selector->value())) {
+ Element* element = rootNode->treeScope()->getElementById(selector->value());
+ if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)))
+ rootNode = element;
+ else if (!element || matchSingleNode)
+ rootNode = 0;
+ if (matchSingleNode)
+ return std::make_pair(true, rootNode);
+ if (startFromParent && rootNode)
+ rootNode = rootNode->parentNode();
+ return std::make_pair(false, rootNode);
+ }
+ if (selector->relation() == CSSSelector::SubSelector)
+ continue;
+ matchSingleNode = false;
+ if (selector->relation() == CSSSelector::DirectAdjacent || selector->relation() == CSSSelector::IndirectAdjacent)
+ startFromParent = true;
+ else
+ startFromParent = false;
+ }
+ return std::make_pair(false, rootNode);
+}
+
template <bool firstMatchOnly>
void SelectorDataList::execute(Node* rootNode, Vector<RefPtr<Node> >& matchedElements) const
{
- if (canUseIdLookup(rootNode)) {
+ std::pair<bool, Node*> traverseRoot = findTraverseRoot(rootNode);
+ if (!traverseRoot.second)
+ return;
+ Node* traverseRootNode = traverseRoot.second;
+ if (traverseRoot.first) {
ASSERT(m_selectors.size() == 1);
- const CSSSelector* selector = m_selectors[0].selector;
- Element* element = rootNode->treeScope()->getElementById(selector->value());
- if (!element || !(isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)))
- return;
+ ASSERT(traverseRootNode->isElementNode());
+ Element* element = toElement(traverseRootNode);
if (selectorMatches(m_selectors[0], element, rootNode))
matchedElements.append(element);
return;
@@ -137,7 +165,7 @@
unsigned selectorCount = m_selectors.size();
- Node* n = rootNode->firstChild();
+ Node* n = traverseRootNode->firstChild();
while (n) {
if (n->isElementNode()) {
Element* element = toElement(n);
@@ -156,7 +184,7 @@
}
while (!n->nextSibling()) {
n = n->parentNode();
- if (n == rootNode)
+ if (n == traverseRootNode)
return;
}
n = n->nextSibling();
diff --git a/Source/core/dom/SelectorQuery.h b/Source/core/dom/SelectorQuery.h
index 779e782..79e6381 100644
--- a/Source/core/dom/SelectorQuery.h
+++ b/Source/core/dom/SelectorQuery.h
@@ -56,7 +56,7 @@
};
bool selectorMatches(const SelectorData&, Element*, const Node*) const;
- bool canUseIdLookup(Node* rootNode) const;
+ std::pair<bool, Node*> findTraverseRoot(Node* traverseRoot) const;
template <bool firstMatchOnly>
void execute(Node* rootNode, Vector<RefPtr<Node> >&) const;
diff --git a/Source/core/dom/StyleElement.cpp b/Source/core/dom/StyleElement.cpp
index 0d961aa..81503aa 100644
--- a/Source/core/dom/StyleElement.cpp
+++ b/Source/core/dom/StyleElement.cpp
@@ -24,7 +24,6 @@
#include "core/css/MediaList.h"
#include "core/css/MediaQueryEvaluator.h"
#include "core/css/StyleSheetContents.h"
-#include "core/dom/Attribute.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentStyleSheetCollection.h"
#include "core/dom/Element.h"
@@ -50,10 +49,10 @@
StyleElement::StyleElement(Document* document, bool createdByParser)
: m_createdByParser(createdByParser)
, m_loading(false)
- , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
+ , m_startPosition(TextPosition::belowRangePosition())
{
if (createdByParser && document && document->scriptableDocumentParser() && !document->isInDocumentWrite())
- m_startLineNumber = document->scriptableDocumentParser()->lineNumber();
+ m_startPosition = document->scriptableDocumentParser()->textPosition();
}
StyleElement::~StyleElement()
@@ -120,7 +119,7 @@
if (isValidStyleChild(c)) {
unsigned length = c->nodeValue().length();
if (length > std::numeric_limits<unsigned>::max() - resultLength) {
- createSheet(e, m_startLineNumber, "");
+ createSheet(e, "");
return;
}
resultLength += length;
@@ -136,7 +135,7 @@
}
ASSERT(sheetText.length() == resultLength);
- createSheet(e, m_startLineNumber, sheetText.toString());
+ createSheet(e, sheetText.toString());
}
void StyleElement::clearSheet()
@@ -145,7 +144,7 @@
m_sheet.release()->clearOwnerNode();
}
-void StyleElement::createSheet(Element* e, WTF::OrdinalNumber startLineNumber, const String& text)
+void StyleElement::createSheet(Element* e, const String& text)
{
ASSERT(e);
ASSERT(e->inDocument());
@@ -158,7 +157,7 @@
// If type is empty or CSS, this is a CSS style sheet.
const AtomicString& type = this->type();
- if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url(), startLineNumber) && isCSS(e, type)) {
+ if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url(), m_startPosition.m_line) && isCSS(e, type)) {
RefPtr<MediaQuerySet> mediaQueries;
if (e->isHTMLElement())
mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(media());
@@ -171,10 +170,11 @@
document->styleSheetCollection()->addPendingSheet();
m_loading = true;
- m_sheet = CSSStyleSheet::createInline(e, KURL(), document->inputEncoding());
+ TextPosition startPosition = m_startPosition == TextPosition::belowRangePosition() ? TextPosition::minimumPosition() : m_startPosition;
+ m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, document->inputEncoding());
m_sheet->setMediaQueries(mediaQueries.release());
m_sheet->setTitle(e->title());
- m_sheet->contents()->parseStringAtLine(text, startLineNumber.zeroBasedInt(), m_createdByParser);
+ m_sheet->contents()->parseStringAtLine(text, startPosition.m_line.zeroBasedInt(), m_createdByParser);
m_loading = false;
}
diff --git a/Source/core/dom/StyleElement.h b/Source/core/dom/StyleElement.h
index 83c8b9b..87ab56f 100644
--- a/Source/core/dom/StyleElement.h
+++ b/Source/core/dom/StyleElement.h
@@ -22,7 +22,7 @@
#define StyleElement_h
#include "core/css/CSSStyleSheet.h"
-#include <wtf/text/TextPosition.h>
+#include "wtf/text/TextPosition.h"
namespace WebCore {
@@ -53,13 +53,13 @@
RefPtr<CSSStyleSheet> m_sheet;
private:
- void createSheet(Element*, WTF::OrdinalNumber startLineNumber, const String& text = String());
+ void createSheet(Element*, const String& text = String());
void process(Element*);
void clearSheet();
bool m_createdByParser;
bool m_loading;
- WTF::OrdinalNumber m_startLineNumber;
+ TextPosition m_startPosition;
};
}
diff --git a/Source/core/dom/StyledElement.cpp b/Source/core/dom/StyledElement.cpp
index e975d03..28cdec9 100644
--- a/Source/core/dom/StyledElement.cpp
+++ b/Source/core/dom/StyledElement.cpp
@@ -86,7 +86,8 @@
WTF_MAKE_NONCOPYABLE(PresentationAttributeCacheCleaner); WTF_MAKE_FAST_ALLOCATED;
public:
PresentationAttributeCacheCleaner()
- : m_cleanTimer(this, &PresentationAttributeCacheCleaner::cleanCache)
+ : m_hitCount(0)
+ , m_cleanTimer(this, &PresentationAttributeCacheCleaner::cleanCache)
{
}
@@ -150,9 +151,9 @@
{
RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData()->m_inlineStyle;
if (!inlineStyle)
- inlineStyle = StylePropertySet::create(strictToCSSParserMode(isHTMLElement() && !document()->inQuirksMode()));
+ inlineStyle = MutableStylePropertySet::create(strictToCSSParserMode(isHTMLElement() && !document()->inQuirksMode()));
else if (!inlineStyle->isMutable())
- inlineStyle = inlineStyle->copy();
+ inlineStyle = inlineStyle->mutableCopy();
ASSERT(inlineStyle->isMutable());
return static_cast<MutableStylePropertySet*>(inlineStyle.get());
}
@@ -173,7 +174,7 @@
{
if (!inlineStyle() || !inlineStyle()->hasCSSOMWrapper())
return 0;
- PropertySetCSSStyleDeclaration* cssomWrapper = ensureUniqueElementData()->m_inlineStyle->cssStyleDeclaration();
+ PropertySetCSSStyleDeclaration* cssomWrapper = ensureMutableInlineStyle()->cssStyleDeclaration();
ASSERT(cssomWrapper && cssomWrapper->parentElement() == this);
return cssomWrapper;
}
@@ -193,8 +194,10 @@
if (!inlineStyle)
inlineStyle = CSSParser::parseInlineStyleDeclaration(newStyleString, this);
- else
- inlineStyle->parseDeclaration(newStyleString, document()->elementSheet()->contents());
+ else {
+ ASSERT(inlineStyle->isMutable());
+ static_pointer_cast<MutableStylePropertySet>(inlineStyle)->parseDeclaration(newStyleString, document()->elementSheet()->contents());
+ }
}
void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, AttributeModificationReason modificationReason)
@@ -333,7 +336,7 @@
style = cacheIterator->value->value;
presentationAttributeCacheCleaner().didHitPresentationAttributeCache();
} else {
- style = StylePropertySet::create(isSVGElement() ? SVGAttributeMode : CSSQuirksMode);
+ style = MutableStylePropertySet::create(isSVGElement() ? SVGAttributeMode : CSSQuirksMode);
unsigned size = attributeCount();
for (unsigned i = 0; i < size; ++i) {
const Attribute* attribute = attributeItem(i);
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 21cb569..fbd177f 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -22,22 +22,18 @@
#include "config.h"
#include "core/dom/Text.h"
+#include "SVGNames.h"
+#include "core/css/resolver/StyleResolver.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExceptionCodePlaceholder.h"
#include "core/dom/NodeRenderingContext.h"
+#include "core/dom/ScopedEventQueue.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/rendering/RenderCombineText.h"
#include "core/rendering/RenderText.h"
-
-#if ENABLE(SVG)
-#include "SVGNames.h"
#include "core/rendering/svg/RenderSVGInlineText.h"
-#endif
-
-#include "core/css/resolver/StyleResolver.h"
-#include "core/rendering/style/StyleInheritedData.h"
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
+#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
using namespace std;
@@ -69,6 +65,7 @@
return 0;
}
+ EventQueueScope scope;
String oldStr = data();
RefPtr<Text> newText = cloneWithData(oldStr.substring(offset));
setDataWithoutUpdate(oldStr.substring(0, offset));
@@ -245,7 +242,6 @@
return true;
}
-#if ENABLE(SVG)
static bool isSVGShadowText(Text* text)
{
Node* parentNode = text->parentNode();
@@ -257,7 +253,6 @@
Node* parentOrShadowHostNode = text->parentOrShadowHostNode();
return parentOrShadowHostNode->isSVGElement() && !parentOrShadowHostNode->hasTagName(SVGNames::foreignObjectTag);
}
-#endif
void Text::createTextRendererIfNeeded()
{
@@ -266,10 +261,9 @@
RenderText* Text::createTextRenderer(RenderArena* arena, RenderStyle* style)
{
-#if ENABLE(SVG)
if (isSVGText(this) || isSVGShadowText(this))
return new (arena) RenderSVGInlineText(this, dataImpl());
-#endif
+
if (style->hasTextCombine())
return new (arena) RenderCombineText(this, dataImpl());
@@ -300,10 +294,13 @@
void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData)
{
- if (!attached())
+ if (!attached() && !needsStyleRecalc())
return;
RenderText* textRenderer = toRenderText(renderer());
if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRenderer->style()))) {
+ // FIXME: Editing code expects that inserting a text node will produce a renderer
+ // immediately so it can inspect the style of the text nodes. We should fix this
+ // so we can lazyReattach here.
reattach();
return;
}
diff --git a/Source/core/dom/Text.idl b/Source/core/dom/Text.idl
index a86f063..9ccd7e0 100644
--- a/Source/core/dom/Text.idl
+++ b/Source/core/dom/Text.idl
@@ -19,8 +19,7 @@
[
Constructor([Default=NullString] optional DOMString data),
CallWith=ScriptExecutionContext,
- CustomToV8,
- SkipVTableValidation,
+ CustomToV8
] interface Text : CharacterData {
// DOM Level 1
diff --git a/Source/core/dom/Touch.cpp b/Source/core/dom/Touch.cpp
index a6ccaa7..170af00 100644
--- a/Source/core/dom/Touch.cpp
+++ b/Source/core/dom/Touch.cpp
@@ -27,7 +27,6 @@
#include "core/dom/Touch.h"
-#include "core/page/DOMWindow.h"
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
@@ -67,6 +66,7 @@
, m_rotationAngle(rotationAngle)
, m_force(force)
{
+ ScriptWrappable::init(this);
float scaleFactor = frame->pageZoomFactor();
float x = pageX * scaleFactor;
float y = pageY * scaleFactor;
@@ -88,6 +88,7 @@
, m_force(force)
, m_absoluteLocation(absoluteLocation)
{
+ ScriptWrappable::init(this);
}
PassRefPtr<Touch> Touch::cloneWithNewTarget(EventTarget* eventTarget) const
diff --git a/Source/core/dom/Touch.h b/Source/core/dom/Touch.h
index f63a6bd..bc2c28a 100644
--- a/Source/core/dom/Touch.h
+++ b/Source/core/dom/Touch.h
@@ -26,23 +26,24 @@
#ifndef Touch_h
#define Touch_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/EventTarget.h"
#include "core/platform/graphics/LayoutPoint.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
namespace WebCore {
class Frame;
-class Touch : public RefCounted<Touch> {
+class Touch : public RefCounted<Touch>, public ScriptWrappable {
public:
static PassRefPtr<Touch> create(Frame* frame, EventTarget* target,
unsigned identifier, int screenX, int screenY, int pageX, int pageY,
int radiusX, int radiusY, float rotationAngle, float force)
{
- return adoptRef(new Touch(frame, target, identifier, screenX,
+ return adoptRef(new Touch(frame, target, identifier, screenX,
screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force));
}
diff --git a/Source/core/dom/Touch.idl b/Source/core/dom/Touch.idl
index f7a25b5..2d89c3b 100644
--- a/Source/core/dom/Touch.idl
+++ b/Source/core/dom/Touch.idl
@@ -24,8 +24,7 @@
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface Touch {
readonly attribute long clientX;
readonly attribute long clientY;
diff --git a/Source/core/dom/TouchEvent.idl b/Source/core/dom/TouchEvent.idl
index 043024e..c0838a8 100644
--- a/Source/core/dom/TouchEvent.idl
+++ b/Source/core/dom/TouchEvent.idl
@@ -24,7 +24,7 @@
*/
[
- NoInterfaceObject,
+ NoInterfaceObject
] interface TouchEvent : UIEvent {
readonly attribute TouchList touches;
readonly attribute TouchList targetTouches;
diff --git a/Source/core/dom/TouchList.h b/Source/core/dom/TouchList.h
index ed87938..74a712c 100644
--- a/Source/core/dom/TouchList.h
+++ b/Source/core/dom/TouchList.h
@@ -26,13 +26,14 @@
#ifndef TouchList_h
#define TouchList_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/Touch.h"
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
namespace WebCore {
-class TouchList : public RefCounted<TouchList> {
+class TouchList : public RefCounted<TouchList>, public ScriptWrappable {
public:
static PassRefPtr<TouchList> create()
{
@@ -47,7 +48,10 @@
void append(const PassRefPtr<Touch> touch) { m_values.append(touch); }
private:
- TouchList() {}
+ TouchList()
+ {
+ ScriptWrappable::init(this);
+ }
Vector<RefPtr<Touch> > m_values;
};
diff --git a/Source/core/dom/TouchList.idl b/Source/core/dom/TouchList.idl
index e1410db..19900ac 100644
--- a/Source/core/dom/TouchList.idl
+++ b/Source/core/dom/TouchList.idl
@@ -24,8 +24,7 @@
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface TouchList {
readonly attribute unsigned long length;
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 3087be8..c4b5625 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -35,19 +35,15 @@
#include "core/dom/IdTargetObserverRegistry.h"
#include "core/dom/NodeTraversal.h"
#include "core/dom/TreeScopeAdopter.h"
-#include "core/dom/shadow/InsertionPoint.h"
-#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/HTMLAnchorElement.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLLabelElement.h"
#include "core/html/HTMLMapElement.h"
#include "core/page/DOMSelection.h"
-#include "core/page/DOMWindow.h"
#include "core/page/FocusController.h"
#include "core/page/Frame.h"
#include "core/page/FrameView.h"
#include "core/page/Page.h"
-#include "RuntimeEnabledFeatures.h"
#include "core/rendering/HitTestResult.h"
#include "core/rendering/RenderView.h"
#include <wtf/text/AtomicString.h>
diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
index cd36f11..0c3387c 100644
--- a/Source/core/dom/TreeScopeAdopter.cpp
+++ b/Source/core/dom/TreeScopeAdopter.cpp
@@ -27,12 +27,10 @@
#include "core/dom/Attr.h"
#include "core/dom/Document.h"
-#include "core/dom/ElementRareData.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/ShadowRoot.h"
-#include "core/rendering/style/RenderStyle.h"
namespace WebCore {
diff --git a/Source/core/dom/TreeWalker.idl b/Source/core/dom/TreeWalker.idl
index 7bb72fb..2188bef 100644
--- a/Source/core/dom/TreeWalker.idl
+++ b/Source/core/dom/TreeWalker.idl
@@ -20,8 +20,7 @@
// Introduced in DOM Level 2:
[
- NoInterfaceObject,
- ImplementationLacksVTable
+ NoInterfaceObject
] interface TreeWalker {
readonly attribute Node root;
readonly attribute unsigned long whatToShow;
diff --git a/Source/core/dom/UIEvent.cpp b/Source/core/dom/UIEvent.cpp
index 641ebe6..ade3856 100644
--- a/Source/core/dom/UIEvent.cpp
+++ b/Source/core/dom/UIEvent.cpp
@@ -23,9 +23,6 @@
#include "config.h"
#include "core/dom/UIEvent.h"
-#include "core/dom/EventDispatcher.h"
-#include "core/dom/Node.h"
-#include "core/page/Console.h"
#include "core/page/DOMWindow.h"
namespace WebCore {
diff --git a/Source/core/dom/UserActionElementSet.cpp b/Source/core/dom/UserActionElementSet.cpp
index 03268fe..264061f 100644
--- a/Source/core/dom/UserActionElementSet.cpp
+++ b/Source/core/dom/UserActionElementSet.cpp
@@ -27,7 +27,6 @@
#include "config.h"
#include "core/dom/UserActionElementSet.h"
-#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/Node.h"
diff --git a/Source/core/dom/ViewportArguments.cpp b/Source/core/dom/ViewportArguments.cpp
index ec88fbc..8593f84 100644
--- a/Source/core/dom/ViewportArguments.cpp
+++ b/Source/core/dom/ViewportArguments.cpp
@@ -29,12 +29,6 @@
#include "core/dom/ViewportArguments.h"
#include "core/dom/Document.h"
-#include "core/dom/ScriptableDocumentParser.h"
-#include "core/page/Chrome.h"
-#include "core/page/Console.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/Page.h"
#include "core/platform/graphics/IntSize.h"
#include <wtf/text/WTFString.h>
@@ -42,8 +36,6 @@
namespace WebCore {
-const float ViewportArguments::deprecatedTargetDPI = 160;
-
static const float& compareIgnoringAuto(const float& value1, const float& value2, const float& (*compare) (const float&, const float&))
{
ASSERT(value1 != ViewportArguments::ValueAuto || value2 != ViewportArguments::ValueAuto);
@@ -79,7 +71,7 @@
return value;
}
-ViewportAttributes ViewportArguments::resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const
+PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const
{
float resultWidth = width;
float resultMaxWidth = maxWidth;
@@ -190,8 +182,7 @@
resultMaxZoom = clampScaleValue(resultMaxZoom);
}
- ViewportAttributes result;
- result.orientation = orientation;
+ PageScaleConstraints result;
// Resolve minimum-scale and maximum-scale values according to spec.
if (resultMinZoom == ViewportArguments::ValueAuto)
@@ -244,50 +235,16 @@
result.layoutSize.setWidth(resultWidth);
result.layoutSize.setHeight(resultHeight);
- // FIXME: This might affect some ports, but is the right thing to do.
- // Only set initialScale to a value if it was explicitly set.
- // if (resultZoom == ViewportArguments::ValueAuto)
- // result.initialScale = ViewportArguments::ValueAuto;
-
- result.userScalable = resultUserZoom;
- result.orientation = orientation;
-
- return result;
-}
-
-static FloatSize convertToUserSpace(const FloatSize& deviceSize, float devicePixelRatio)
-{
- FloatSize result = deviceSize;
- if (devicePixelRatio != 1)
- result.scale(1 / devicePixelRatio);
- return result;
-}
-
-ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport)
-{
- FloatSize initialViewportSize = convertToUserSpace(visibleViewport, devicePixelRatio);
- FloatSize deviceSize = convertToUserSpace(FloatSize(deviceWidth, deviceHeight), devicePixelRatio);
-
- return args.resolve(initialViewportSize, deviceSize, desktopWidth);
-}
-
-float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& visibleViewport, const IntSize& contentsSize)
-{
- FloatSize viewportSize(visibleViewport);
- return max<float>(result.minimumScale, max(viewportSize.width() / contentsSize.width(), viewportSize.height() / contentsSize.height()));
-}
-
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio)
-{
- FloatSize viewportSize = convertToUserSpace(visibleViewport, devicePixelRatio);
-
- result.minimumScale = max<float>(result.minimumScale, max(viewportSize.width() / result.layoutSize.width(), viewportSize.height() / result.layoutSize.height()));
-}
-
-void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result)
-{
- if (!result.userScalable)
+ // If user-scalable = no, lock the min/max scale to the computed initial
+ // scale.
+ if (!resultUserZoom)
result.maximumScale = result.minimumScale = result.initialScale;
+
+ // Only set initialScale to a value if it was explicitly set.
+ if (resultZoom == ViewportArguments::ValueAuto)
+ result.initialScale = ViewportArguments::ValueAuto;
+
+ return result;
}
static float numericPrefix(const String& keyString, const String& valueString, Document* document, bool* ok = 0)
diff --git a/Source/core/dom/ViewportArguments.h b/Source/core/dom/ViewportArguments.h
index e6c61e6..a311af6 100644
--- a/Source/core/dom/ViewportArguments.h
+++ b/Source/core/dom/ViewportArguments.h
@@ -28,6 +28,7 @@
#ifndef ViewportArguments_h
#define ViewportArguments_h
+#include "core/page/PageScaleConstraints.h"
#include "core/platform/graphics/FloatSize.h"
#include <wtf/Forward.h>
@@ -43,17 +44,6 @@
TargetDensityDpiUnsupported
};
-struct ViewportAttributes {
- FloatSize layoutSize;
-
- float initialScale;
- float minimumScale;
- float maximumScale;
-
- float userScalable;
- float orientation;
-};
-
struct ViewportArguments {
enum Type {
@@ -96,7 +86,7 @@
}
// All arguments are in CSS units.
- ViewportAttributes resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const;
+ PageScaleConstraints resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const;
float width;
float minWidth;
@@ -133,18 +123,8 @@
{
return !(*this == other);
}
-
- // FIXME: We're going to keep this constant around until all embedders
- // refactor their code to no longer need it.
- static const float deprecatedTargetDPI;
};
-ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport);
-
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio);
-void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
-float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentSize);
-
void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);
diff --git a/Source/core/dom/VisitedLinkState.cpp b/Source/core/dom/VisitedLinkState.cpp
index 2e0e5e8..946f967 100644
--- a/Source/core/dom/VisitedLinkState.cpp
+++ b/Source/core/dom/VisitedLinkState.cpp
@@ -32,23 +32,35 @@
#include "HTMLNames.h"
#include "core/dom/NodeTraversal.h"
#include "core/html/HTMLAnchorElement.h"
-#include "core/page/Frame.h"
#include "core/page/Page.h"
-#include "core/platform/VisitedLinks.h"
+#include <public/Platform.h>
namespace WebCore {
using namespace HTMLNames;
-inline static const AtomicString* linkAttribute(Element* element)
+inline static const AtomicString& linkAttribute(Element* element)
{
- if (!element->isLink())
- return 0;
+ ASSERT(element->isLink());
if (element->isHTMLElement())
- return &element->fastGetAttribute(HTMLNames::hrefAttr);
- if (element->isSVGElement())
- return &element->getAttribute(XLinkNames::hrefAttr);
- return 0;
+ return element->fastGetAttribute(HTMLNames::hrefAttr);
+ ASSERT(element->isSVGElement());
+ return element->getAttribute(XLinkNames::hrefAttr);
+}
+
+inline static LinkHash linkHashForElement(Document* document, Element* element)
+{
+ if (element->hasTagName(aTag))
+ return static_cast<HTMLAnchorElement*>(element)->visitedLinkHash();
+ return visitedLinkHash(document->baseURL(), linkAttribute(element));
+}
+
+inline static LinkHash linkHashForElementWithAttribute(Document* document, Element* element, const AtomicString& attribute)
+{
+ ASSERT(linkAttribute(element) == attribute);
+ if (element->hasTagName(aTag))
+ return static_cast<HTMLAnchorElement*>(element)->visitedLinkHash();
+ return visitedLinkHash(document->baseURL(), attribute);
}
PassOwnPtr<VisitedLinkState> VisitedLinkState::create(Document* document)
@@ -71,21 +83,12 @@
}
}
-inline static LinkHash linkHashForElement(Document* document, Element* element)
-{
- if (element->hasTagName(aTag))
- return static_cast<HTMLAnchorElement*>(element)->visitedLinkHash();
- if (const AtomicString* attribute = linkAttribute(element))
- return WebCore::visitedLinkHash(document->baseURL(), *attribute);
- return 0;
-}
-
void VisitedLinkState::invalidateStyleForLink(LinkHash linkHash)
{
if (!m_linksCheckedForVisitedState.contains(linkHash))
return;
for (Element* element = ElementTraversal::firstWithin(m_document); element; element = ElementTraversal::next(element)) {
- if (linkHashForElement(m_document, element) == linkHash)
+ if (element->isLink() && linkHashForElement(m_document, element) == linkHash)
element->setNeedsStyleRecalc();
}
}
@@ -94,35 +97,30 @@
{
ASSERT(element->isLink());
- const AtomicString* attribute = linkAttribute(element);
- if (!attribute || attribute->isNull())
- return NotInsideLink;
+ const AtomicString& attribute = linkAttribute(element);
- // An empty href refers to the document itself which is always visited. It is useful to check this explicitly so
- // that visited links can be tested in platform independent manner, without explicit support in the test harness.
- if (attribute->isEmpty())
+ if (attribute.isNull())
+ return NotInsideLink; // This can happen for <img usemap>
+
+ // An empty attribute refers to the document itself which is always
+ // visited. It is useful to check this explicitly so that visited
+ // links can be tested in platform independent manner, without
+ // explicit support in the test harness.
+ if (attribute.isEmpty())
return InsideVisitedLink;
- LinkHash hash;
- if (element->hasTagName(aTag))
- hash = static_cast<HTMLAnchorElement*>(element)->visitedLinkHash();
- else
- hash = WebCore::visitedLinkHash(element->document()->baseURL(), *attribute);
+ // We null check the Frame here to avoid canonicalizing and hashing
+ // URLs in documents that aren't attached to Frames (like documents
+ // from XMLHttpRequest).
+ if (!m_document->frame())
+ return InsideUnvisitedLink;
+ LinkHash hash = linkHashForElementWithAttribute(m_document, element, attribute);
if (!hash)
return InsideUnvisitedLink;
- Frame* frame = element->document()->frame();
- if (!frame)
- return InsideUnvisitedLink;
-
- Page* page = frame->page();
- if (!page)
- return InsideUnvisitedLink;
-
m_linksCheckedForVisitedState.add(hash);
-
- return VisitedLinks::isLinkVisited(hash) ? InsideVisitedLink : InsideUnvisitedLink;
+ return WebKit::Platform::current()->isLinkVisited(hash) ? InsideVisitedLink : InsideUnvisitedLink;
}
}
diff --git a/Source/core/dom/VisitedLinkState.h b/Source/core/dom/VisitedLinkState.h
index 74e6c1a..dc5338c 100644
--- a/Source/core/dom/VisitedLinkState.h
+++ b/Source/core/dom/VisitedLinkState.h
@@ -33,8 +33,8 @@
#include "core/dom/Element.h"
#include "core/platform/LinkHash.h"
#include "core/rendering/style/RenderStyleConstants.h"
-#include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
+#include "wtf/HashSet.h"
+#include "wtf/OwnPtr.h"
namespace WebCore {
@@ -50,7 +50,7 @@
EInsideLink determineLinkState(Element*);
private:
- VisitedLinkState(Document*);
+ explicit VisitedLinkState(Document*);
EInsideLink determineLinkStateSlowCase(Element*);
diff --git a/Source/core/dom/WheelEvent.cpp b/Source/core/dom/WheelEvent.cpp
index 81135f8..a0a1ec6 100644
--- a/Source/core/dom/WheelEvent.cpp
+++ b/Source/core/dom/WheelEvent.cpp
@@ -24,7 +24,6 @@
#include "core/dom/WheelEvent.h"
#include "core/dom/Clipboard.h"
-#include "core/dom/EventDispatcher.h"
#include "core/dom/EventNames.h"
#include "core/platform/PlatformWheelEvent.h"
diff --git a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp b/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
index 59f84a6..f0684dc 100644
--- a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
+++ b/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
@@ -33,7 +33,6 @@
#include "bindings/v8/SerializedScriptValue.h"
#include "core/dom/MessagePort.h"
-#include "core/dom/ScriptExecutionContext.h"
#include <public/Platform.h>
#include <public/WebMessagePortChannel.h>
diff --git a/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp b/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp
index 1c4f81f..e647b33 100644
--- a/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp
+++ b/Source/core/dom/shadow/ComposedShadowTreeWalker.cpp
@@ -29,12 +29,9 @@
#include "core/dom/shadow/ComposedShadowTreeWalker.h"
#include "core/dom/Element.h"
-#include "core/dom/PseudoElement.h"
#include "core/dom/shadow/ContentDistributor.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/InsertionPoint.h"
-#include "core/html/shadow/HTMLContentElement.h"
-#include "core/html/shadow/HTMLShadowElement.h"
namespace WebCore {
diff --git a/Source/core/dom/shadow/ContentSelectorQuery.cpp b/Source/core/dom/shadow/ContentSelectorQuery.cpp
index 17c5aae..99f2429 100644
--- a/Source/core/dom/shadow/ContentSelectorQuery.cpp
+++ b/Source/core/dom/shadow/ContentSelectorQuery.cpp
@@ -31,7 +31,6 @@
#include "core/css/SelectorChecker.h"
#include "core/css/SiblingTraversalStrategies.h"
#include "core/dom/shadow/InsertionPoint.h"
-#include "core/dom/shadow/ShadowRoot.h"
namespace WebCore {
diff --git a/Source/core/dom/shadow/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
index f40edc3..3bc753a 100644
--- a/Source/core/dom/shadow/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -28,7 +28,6 @@
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/ContainerNodeAlgorithms.h"
-#include "core/inspector/InspectorInstrumentation.h"
namespace WebCore {
@@ -45,9 +44,6 @@
// Existence of shadow roots requires the host and its children to do traversal using ComposedShadowTreeWalker.
shadowHost->setNeedsShadowTreeWalker();
- // FIXME(94905): ShadowHost should be reattached during recalcStyle.
- // Set some flag here and recreate shadow hosts' renderer in
- // Element::recalcStyle.
if (shadowHost->attached())
shadowHost->lazyReattach();
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
index 7c0aad9..fcf1756 100644
--- a/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -142,6 +142,12 @@
StyleResolver* styleResolver = document()->styleResolver();
styleResolver->pushParentShadowRoot(this);
+ // When we're set to lazyAttach we'll have a FullStyleChange and we'll need
+ // to promote the change to a Force for all our descendants so they get a
+ // recalc and will attach.
+ if (styleChangeType() == FullStyleChange)
+ change = Force;
+
for (Node* child = firstChild(); child; child = child->nextSibling()) {
if (child->isElementNode())
toElement(child)->recalcStyle(change);
@@ -159,10 +165,13 @@
if (isOrphan())
return;
- if (m_applyAuthorStyles != value) {
- m_applyAuthorStyles = value;
+ if (m_applyAuthorStyles == value)
+ return;
+
+ m_applyAuthorStyles = value;
+ // FIXME: Why do we need to recalc style on all other shadow roots too?
+ if (attached())
host()->setNeedsStyleRecalc();
- }
}
void ShadowRoot::setResetStyleInheritance(bool value)
@@ -170,11 +179,13 @@
if (isOrphan())
return;
- if (value != m_resetStyleInheritance) {
- m_resetStyleInheritance = value;
- if (attached() && owner())
- owner()->recalcStyle(Force);
- }
+ if (value == m_resetStyleInheritance)
+ return;
+
+ m_resetStyleInheritance = value;
+ // FIXME: Why do we need to recalc style on all other shadow roots too?
+ if (attached())
+ host()->setNeedsStyleRecalc();
}
void ShadowRoot::attach()
diff --git a/Source/core/dom/shadow/ShadowRoot.idl b/Source/core/dom/shadow/ShadowRoot.idl
index 34190bc..39488df 100644
--- a/Source/core/dom/shadow/ShadowRoot.idl
+++ b/Source/core/dom/shadow/ShadowRoot.idl
@@ -25,7 +25,7 @@
*/
[
- NoInterfaceObject,
+ NoInterfaceObject
] interface ShadowRoot : DocumentFragment {
readonly attribute Element activeElement;
attribute boolean applyAuthorStyles;