diff options
Diffstat (limited to 'Source/WebCore/dom/Document.cpp')
-rw-r--r-- | Source/WebCore/dom/Document.cpp | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 063b8a2..f319cac 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -7,6 +7,9 @@ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (C) 2008, 2009 Google Inc. All rights reserved. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (c) 2011, 2012 The Linux Foundation All rights reserved + * Copyright (C) 2011, 2012 Sony Ericsson Mobile Communications AB + * Copyright (C) 2012 Sony Mobile Communcations AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -107,6 +110,7 @@ #include "NestingLevelIncrementer.h" #include "NodeFilter.h" #include "NodeIterator.h" +#include "NodeRareData.h" #include "NodeWithIndex.h" #include "OverflowEvent.h" #include "Page.h" @@ -421,9 +425,13 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) , m_sawElementsInKnownNamespaces(false) , m_usingGeolocation(false) , m_eventQueue(EventQueue::create(this)) + , m_documentRareData(0) #if ENABLE(WML) , m_containsWMLContent(false) #endif +#if ENABLE(WEBGL) && PLATFORM(ANDROID) + , m_containsWebGLContent(false) +#endif , m_weakReference(DocumentWeakReference::create(this)) , m_idAttributeName(idAttr) #if ENABLE(FULLSCREEN_API) @@ -567,6 +575,13 @@ Document::~Document() if (m_implementation) m_implementation->ownerDocumentDestroyed(); + + if (hasRareData()) { + ASSERT(m_documentRareData); + delete m_documentRareData; + m_documentRareData = 0; + clearFlag(HasRareDataFlag); + } } void Document::removedLastRef() @@ -1810,7 +1825,7 @@ void Document::removeAllEventListeners() if (DOMWindow* domWindow = this->domWindow()) domWindow->removeAllEventListeners(); - for (Node* node = firstChild(); node; node = node->traverseNextNode()) + for (Node* node = firstChild(); node; node = node->traverseNextNodeFastPath()) node->removeAllEventListeners(); } @@ -3842,11 +3857,12 @@ static inline bool isValidNameASCII(const UChar* characters, unsigned length) bool Document::isValidName(const String& name) { - unsigned length = name.length(); - if (!length) + if (name.isEmpty()) return false; - const UChar* characters = name.characters(); + StringImpl* impl = name.impl(); + const UChar* characters = impl->characters(); + unsigned length = impl->length(); return isValidNameASCII(characters, length) || isValidNameNonASCII(characters, length); } @@ -5026,15 +5042,15 @@ void Document::loadEventDelayTimerFired(Timer<Document>*) } #if ENABLE(REQUEST_ANIMATION_FRAME) -int Document::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback, Element* animationElement) +int Document::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback) { if (!m_scriptedAnimationController) m_scriptedAnimationController = ScriptedAnimationController::create(this); - return m_scriptedAnimationController->registerCallback(callback, animationElement); + return m_scriptedAnimationController->registerCallback(callback); } -void Document::webkitCancelRequestAnimationFrame(int id) +void Document::webkitCancelAnimationFrame(int id) { if (!m_scriptedAnimationController) return; @@ -5082,4 +5098,29 @@ DocumentLoader* Document::loader() const return loader; } +#if ENABLE(WEBGL) && PLATFORM(ANDROID) +void Document::suspendDocument() +{ + HashSet<Element*>::iterator end = m_documentSuspendCallbackElements.end(); + for (HashSet<Element*>::iterator i = m_documentSuspendCallbackElements.begin(); i != end; ++i) + (*i)->documentWasSuspended(); +} + +void Document::resumeDocument() +{ + HashSet<Element*>::iterator end = m_documentSuspendCallbackElements.end(); + for (HashSet<Element*>::iterator i = m_documentSuspendCallbackElements.begin(); i != end; ++i) + (*i)->documentWillResume(); +} + +void Document::registerForDocumentSuspendCallbacks(Element* e) +{ + m_documentSuspendCallbackElements.add(e); +} + +void Document::unregisterForDocumentSuspendCallbacks(Element* e) +{ + m_documentSuspendCallbackElements.remove(e); +} +#endif } // namespace WebCore |