summaryrefslogtreecommitdiff
path: root/chromium/third_party/WebKit/Source/core/dom
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/dom')
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp2
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Clipboard.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp5
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp5
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp99
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementException.h68
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp62
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h64
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp26
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp44
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h16
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl12
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Document.cpp128
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Document.h22
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Document.idl16
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp217
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h24
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/DocumentType.idl6
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Element.cpp26
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Element.h1
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Element.idl10
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Node.cpp46
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Node.h3
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/Node.idl10
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp2
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/PendingScript.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp12
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp6
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h4
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp2
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp132
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h55
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp4
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp210
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h34
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp14
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp42
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h2
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp3
-rw-r--r--chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h11
43 files changed, 273 insertions, 1188 deletions
diff --git a/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp b/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp
index ee98d9f9586..0c7f7252955 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp
@@ -26,8 +26,8 @@
#include "config.h"
#include "core/dom/Clipboard.h"
-#include "core/fetch/ImageResource.h"
#include "core/fileapi/FileList.h"
+#include "core/loader/cache/ImageResource.h"
namespace WebCore {
diff --git a/chromium/third_party/WebKit/Source/core/dom/Clipboard.h b/chromium/third_party/WebKit/Source/core/dom/Clipboard.h
index bc861ded2e0..a32134b905c 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Clipboard.h
+++ b/chromium/third_party/WebKit/Source/core/dom/Clipboard.h
@@ -27,7 +27,7 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/ClipboardAccessPolicy.h"
#include "core/dom/Node.h"
-#include "core/fetch/ResourcePtr.h"
+#include "core/loader/cache/ResourcePtr.h"
#include "core/page/DragActions.h"
#include "core/platform/DragImage.h"
#include "core/platform/graphics/IntPoint.h"
diff --git a/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index 0fb80f01519..1b26b71ed40 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -25,7 +25,6 @@
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/css/resolver/StyleResolver.h"
#include "core/dom/ChildListMutationScope.h"
#include "core/dom/ContainerNodeAlgorithms.h"
#include "core/dom/EventNames.h"
@@ -683,8 +682,6 @@ void ContainerNode::resumePostAttachCallbacks()
if (s_postAttachCallbackQueue)
dispatchPostAttachCallbacks();
- if (StyleResolver* resolver = document()->styleResolverIfExists())
- resolver->clearStyleSharingList();
}
--s_attachDepth;
}
@@ -1039,8 +1036,6 @@ static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, AttachB
child->lazyAttach();
else
child->attach();
- if (StyleResolver* resolver = parent->document()->document()->styleResolverIfExists())
- resolver->clearStyleSharingList();
}
dispatchChildInsertionEvents(child);
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp
index 1e506c5dcd7..6ffcd2a9730 100644
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp
@@ -35,7 +35,7 @@
#include "MathMLNames.h"
#include "SVGNames.h"
#include "core/dom/CustomElementCallbackScheduler.h"
-#include "core/dom/CustomElementObserver.h"
+#include "core/dom/CustomElementUpgradeCandidateMap.h"
#include "core/dom/Element.h"
namespace WebCore {
@@ -131,13 +131,12 @@ void CustomElement::wasDestroyed(Element* element)
break;
case Element::UpgradeCandidate:
- CustomElementObserver::notifyElementWasDestroyed(element);
+ CustomElementUpgradeCandidateMap::elementWasDestroyed(element);
break;
case Element::Defined:
case Element::Upgraded:
definitions().remove(element);
- CustomElementObserver::notifyElementWasDestroyed(element);
break;
}
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp
deleted file mode 100644
index b5752a8c02d..00000000000
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. 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/CustomElementException.h"
-
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/ExceptionCode.h"
-
-namespace WebCore {
-
-String CustomElementException::preamble(const AtomicString& type)
-{
- return "Failed to call 'register' on 'Document' for type '" + type + "': ";
-}
-
-void CustomElementException::throwException(Reason reason, const AtomicString& type, ExceptionState& es)
-{
- switch (reason) {
- case CannotRegisterFromExtension:
- es.throwDOMException(NotSupportedError, preamble(type) + "elements cannot be registered from extensions.");
- return;
-
- case ConstructorPropertyNotConfigurable:
- es.throwDOMException(NotSupportedError, preamble(type) + "prototype constructor property is not configurable.");
- return;
-
- case ContextDestroyedCheckingPrototype:
- es.throwDOMException(InvalidStateError, preamble(type) + "the context is no longer valid.");
- return;
-
- case ContextDestroyedCreatingCallbacks:
- es.throwDOMException(InvalidStateError);
- return;
-
- case ContextDestroyedRegisteringDefinition:
- es.throwDOMException(NotSupportedError);
- return;
-
- case InvalidName:
- es.throwDOMException(InvalidCharacterError, preamble(type) + ": '" + type + "' is not a valid name.");
- return;
-
- case NotYetImplemented:
- es.throwDOMException(InvalidStateError);
- return;
-
- case PrototypeDoesNotExtendHTMLElementSVGElementNamespace:
- es.throwDOMException(NamespaceError, preamble(type) + "the prototype does not extend an HTML or SVG element.");
- return;
-
- case PrototypeDoesNotExtendHTMLElementSVGElementPrototype:
- es.throwDOMException(InvalidStateError, preamble(type) + "the prototype does not extend an HTML or SVG element.");
- return;
-
- case PrototypeInUse:
- es.throwDOMException(NotSupportedError, preamble(type) + "prototype is already in-use as an interface prototype object.");
- return;
-
- case PrototypeNotAnObject:
- es.throwDOMException(InvalidStateError, preamble(type) + "the prototype option is not an object.");
- return;
-
- case TypeAlreadyRegistered:
- es.throwDOMException(InvalidStateError, preamble(type) + "a type with that name is already registered.");
- return;
- }
-
- ASSERT_NOT_REACHED();
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.h b/chromium/third_party/WebKit/Source/core/dom/CustomElementException.h
deleted file mode 100644
index 622ef220699..00000000000
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. 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 CustomElementException_h
-#define CustomElementException_h
-
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class ExceptionState;
-
-class CustomElementException {
-public:
- enum Reason {
- CannotRegisterFromExtension,
- ConstructorPropertyNotConfigurable,
- ContextDestroyedCheckingPrototype,
- ContextDestroyedCreatingCallbacks,
- ContextDestroyedRegisteringDefinition,
- InvalidName,
- NotYetImplemented,
- PrototypeDoesNotExtendHTMLElementSVGElementNamespace,
- PrototypeDoesNotExtendHTMLElementSVGElementPrototype,
- PrototypeInUse,
- PrototypeNotAnObject,
- TypeAlreadyRegistered
- };
-
- static void throwException(Reason, const AtomicString& type, ExceptionState&);
-
-private:
- CustomElementException();
-
- static String preamble(const AtomicString& type);
-};
-
-}
-
-#endif // CustomElementException_h
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp
deleted file mode 100644
index d4a9fba2842..00000000000
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. 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/CustomElementObserver.h"
-
-namespace WebCore {
-
-CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObservers()
-{
- DEFINE_STATIC_LOCAL(ElementObserverMap, map, ());
- return map;
-}
-
-void CustomElementObserver::notifyElementWasDestroyed(Element* element)
-{
- ElementObserverMap::iterator it = elementObservers().find(element);
- if (it == elementObservers().end())
- return;
- it->value->elementWasDestroyed(element);
-}
-
-void CustomElementObserver::observe(Element* element)
-{
- ElementObserverMap::AddResult result = elementObservers().add(element, this);
- ASSERT(result.isNewEntry);
-}
-
-void CustomElementObserver::unobserve(Element* element)
-{
- CustomElementObserver* observer = elementObservers().take(element);
- ASSERT(observer == this);
-}
-
-} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h b/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h
deleted file mode 100644
index 39d702e6e92..00000000000
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. 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 CustomElementObserver_h
-#define CustomElementObserver_h
-
-#include "wtf/HashMap.h"
-
-namespace WebCore {
-
-class Element;
-
-class CustomElementObserver {
-public:
- CustomElementObserver() { }
- virtual ~CustomElementObserver() { }
-
- // API for CustomElement to kick off notifications
-
- static void notifyElementWasDestroyed(Element*);
-
-protected:
- void observe(Element*);
- void unobserve(Element*);
-
- virtual void elementWasDestroyed(Element* element) { unobserve(element); }
-
-private:
- // Maps elements to the observer watching them. At most one per
- // element at a time.
- typedef HashMap<Element*, CustomElementObserver*> ElementObserverMap;
- static ElementObserverMap& elementObservers();
-};
-
-}
-
-#endif // CustomElementObserver_h
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp
index 472cde1e9d2..9d9195cef5a 100644
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp
@@ -34,11 +34,12 @@
#include "HTMLNames.h"
#include "SVGNames.h"
#include "bindings/v8/CustomElementConstructorBuilder.h"
+#include "bindings/v8/ExceptionState.h"
#include "core/dom/CustomElement.h"
#include "core/dom/CustomElementDefinition.h"
-#include "core/dom/CustomElementException.h"
#include "core/dom/CustomElementRegistrationContext.h"
#include "core/dom/DocumentLifecycleObserver.h"
+#include "core/dom/ExceptionCode.h"
namespace WebCore {
@@ -66,30 +67,31 @@ CustomElementDefinition* CustomElementRegistry::registerElement(Document* docume
// consolidated in one place.
RegistrationContextObserver observer(document);
- AtomicString type = userSuppliedName.lower();
-
if (!constructorBuilder->isFeatureAllowed()) {
- CustomElementException::throwException(CustomElementException::CannotRegisterFromExtension, type, es);
+ es.throwDOMException(NotSupportedError);
return 0;
}
+ AtomicString type = userSuppliedName.lower();
if (!CustomElement::isValidTypeName(type)) {
- CustomElementException::throwException(CustomElementException::InvalidName, type, es);
+ es.throwDOMException(InvalidCharacterError);
return 0;
}
- if (!constructorBuilder->validateOptions(type, es))
+ if (!constructorBuilder->validateOptions()) {
+ es.throwDOMException(InvalidStateError);
return 0;
+ }
QualifiedName tagName = nullQName();
if (!constructorBuilder->findTagName(type, tagName)) {
- CustomElementException::throwException(CustomElementException::PrototypeDoesNotExtendHTMLElementSVGElementNamespace, type, es);
+ es.throwDOMException(NamespaceError);
return 0;
}
ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
if (m_registeredTypeNames.contains(type)) {
- CustomElementException::throwException(CustomElementException::TypeAlreadyRegistered, type, es);
+ es.throwDOMException(InvalidStateError);
return 0;
}
@@ -100,21 +102,23 @@ CustomElementDefinition* CustomElementRegistry::registerElement(Document* docume
// Consulting the constructor builder could execute script and
// kill the document.
if (observer.registrationContextWentAway()) {
- CustomElementException::throwException(CustomElementException::ContextDestroyedCreatingCallbacks, type, es);
+ es.throwDOMException(InvalidStateError);
return 0;
}
const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagName.localName());
RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks);
- if (!constructorBuilder->createConstructor(document, definition.get(), es))
+ if (!constructorBuilder->createConstructor(document, definition.get())) {
+ es.throwDOMException(NotSupportedError);
return 0;
+ }
m_definitions.add(descriptor, definition);
m_registeredTypeNames.add(descriptor.type());
if (!constructorBuilder->didRegisterDefinition(definition.get())) {
- CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, type, es);
+ es.throwDOMException(NotSupportedError);
return 0;
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
index 7dda7901d45..c84bcb7dec5 100644
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
@@ -39,14 +39,14 @@ CustomElementUpgradeCandidateMap::~CustomElementUpgradeCandidateMap()
{
UpgradeCandidateMap::const_iterator::Keys end = m_upgradeCandidates.end().keys();
for (UpgradeCandidateMap::const_iterator::Keys it = m_upgradeCandidates.begin().keys(); it != end; ++it)
- unobserve(*it);
+ unregisterForElementDestructionNotification(*it, this);
}
void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descriptor, Element* element)
{
element->setCustomElementState(Element::UpgradeCandidate);
- observe(element);
+ registerForElementDestructionNotification(element, this);
UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, descriptor);
ASSERT(result.isNewEntry);
@@ -59,18 +59,8 @@ void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descri
void CustomElementUpgradeCandidateMap::remove(Element* element)
{
- unobserve(element);
- removeCommon(element);
-}
-
-void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element)
-{
- CustomElementObserver::elementWasDestroyed(element);
- removeCommon(element);
-}
+ unregisterForElementDestructionNotification(element, this);
-void CustomElementUpgradeCandidateMap::removeCommon(Element* element)
-{
UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
ASSERT(candidate != m_upgradeCandidates.end());
@@ -85,11 +75,37 @@ ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor
const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descriptor);
for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) {
- unobserve(*candidate);
+ unregisterForElementDestructionNotification(*candidate, this);
m_upgradeCandidates.remove(*candidate);
}
return candidates;
}
+void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element)
+{
+ DestructionObserverMap::iterator it = destructionObservers().find(element);
+ if (it == destructionObservers().end())
+ return;
+ it->value->remove(element); // will also remove the destruction observer
+}
+
+CustomElementUpgradeCandidateMap::DestructionObserverMap& CustomElementUpgradeCandidateMap::destructionObservers()
+{
+ DEFINE_STATIC_LOCAL(DestructionObserverMap, map, ());
+ return map;
+}
+
+void CustomElementUpgradeCandidateMap::registerForElementDestructionNotification(Element* element, CustomElementUpgradeCandidateMap* observer)
+{
+ DestructionObserverMap::AddResult result = destructionObservers().add(element, observer);
+ ASSERT(result.isNewEntry);
+}
+
+void CustomElementUpgradeCandidateMap::unregisterForElementDestructionNotification(Element* element, CustomElementUpgradeCandidateMap* observer)
+{
+ CustomElementUpgradeCandidateMap* map = destructionObservers().take(element);
+ ASSERT(map == observer);
+}
+
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h
index 0fef2f85969..2814c0a2d20 100644
--- a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h
+++ b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h
@@ -33,7 +33,6 @@
#include "core/dom/CustomElementDescriptor.h"
#include "core/dom/CustomElementDescriptorHash.h"
-#include "core/dom/CustomElementObserver.h"
#include "wtf/HashMap.h"
#include "wtf/ListHashSet.h"
#include "wtf/Noncopyable.h"
@@ -42,23 +41,26 @@ namespace WebCore {
class Element;
-class CustomElementUpgradeCandidateMap : CustomElementObserver {
+class CustomElementUpgradeCandidateMap {
WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap);
public:
CustomElementUpgradeCandidateMap() { }
~CustomElementUpgradeCandidateMap();
- // API for CustomElementRegistrationContext to save and take candidates
-
- typedef ListHashSet<Element*> ElementSet;
+ static void elementWasDestroyed(Element*);
void add(const CustomElementDescriptor&, Element*);
void remove(Element*);
+
+ typedef ListHashSet<Element*> ElementSet;
ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&);
private:
- virtual void elementWasDestroyed(Element*) OVERRIDE;
- void removeCommon(Element*);
+ // Maps elements to upgrade candidate maps observing their destruction
+ typedef HashMap<Element*, CustomElementUpgradeCandidateMap*> DestructionObserverMap;
+ static DestructionObserverMap& destructionObservers();
+ static void registerForElementDestructionNotification(Element*, CustomElementUpgradeCandidateMap*);
+ static void unregisterForElementDestructionNotification(Element*, CustomElementUpgradeCandidateMap*);
typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap;
UpgradeCandidateMap m_upgradeCandidates;
diff --git a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h
index 90d847f886a..91fd9679e1d 100644
--- a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h
+++ b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h
@@ -56,8 +56,8 @@ public:
virtual PassRefPtr<DataTransferItem> item(unsigned long index) = 0;
virtual void deleteItem(unsigned long index, ExceptionState&) = 0;
virtual void clear() = 0;
- virtual PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&) = 0;
- virtual PassRefPtr<DataTransferItem> add(PassRefPtr<File>) = 0;
+ virtual void add(const String& data, const String& type, ExceptionState&) = 0;
+ virtual void add(PassRefPtr<File>) = 0;
};
} // namespace WebCore
diff --git a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl
index 0babe031c24..eec5c0c5020 100644
--- a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl
+++ b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl
@@ -28,13 +28,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-interface DataTransferItemList {
+[
+ NoInterfaceObject
+] interface DataTransferItemList {
readonly attribute long length;
- [ImplementedAs=item] getter DataTransferItem (unsigned long index);
+ getter DataTransferItem item([Default=Undefined] optional unsigned long index);
- [RaisesException, ImplementedAs=deleteItem] void remove(unsigned long index);
void clear();
- DataTransferItem add(File? file);
- [RaisesException] DataTransferItem add(DOMString data, DOMString type);
+ void add(File? file);
+ [RaisesException] void add([Default=Undefined] optional DOMString data,
+ [Default=Undefined] optional DOMString type);
};
diff --git a/chromium/third_party/WebKit/Source/core/dom/Document.cpp b/chromium/third_party/WebKit/Source/core/dom/Document.cpp
index 82367ea555d..62dee7a7bbf 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/Document.cpp
@@ -51,7 +51,6 @@
#include "core/css/StyleSheetList.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Attr.h"
-#include "core/dom/BeforeUnloadEvent.h"
#include "core/dom/CDATASection.h"
#include "core/dom/Comment.h"
#include "core/dom/ContextFeatures.h"
@@ -98,7 +97,6 @@
#include "core/dom/shadow/ShadowRoot.h"
#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
-#include "core/fetch/ResourceFetcher.h"
#include "core/html/FormController.h"
#include "core/html/HTMLAllCollection.h"
#include "core/html/HTMLAnchorElement.h"
@@ -110,7 +108,6 @@
#include "core/html/HTMLHtmlElement.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/html/HTMLImport.h"
-#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLinkElement.h"
#include "core/html/HTMLNameCollection.h"
#include "core/html/HTMLScriptElement.h"
@@ -131,6 +128,7 @@
#include "core/loader/Prerenderer.h"
#include "core/loader/TextResourceDecoder.h"
#include "core/loader/appcache/ApplicationCacheHost.h"
+#include "core/loader/cache/ResourceFetcher.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
#include "core/page/ContentSecurityPolicy.h"
@@ -146,6 +144,7 @@
#include "core/page/PageConsole.h"
#include "core/page/PointerLockController.h"
#include "core/page/Settings.h"
+#include "core/page/ValidationMessageClient.h"
#include "core/page/animation/AnimationController.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/platform/DateComponents.h"
@@ -436,7 +435,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_referrerPolicy(ReferrerPolicyDefault)
, m_directionSetOnDocumentElement(false)
, m_writingModeSetOnDocumentElement(false)
- , m_didAllowNavigationViaBeforeUnloadConfirmationPanel(false)
, m_writeRecursionIsTooDeep(false)
, m_writeRecursionDepth(0)
, m_wheelEventHandlerCount(0)
@@ -1088,11 +1086,8 @@ void Document::setReadyState(ReadyState readyState)
m_documentTiming.domLoading = monotonicallyIncreasingTime();
break;
case Interactive:
- if (!m_documentTiming.domInteractive) {
+ if (!m_documentTiming.domInteractive)
m_documentTiming.domInteractive = monotonicallyIncreasingTime();
- if (RuntimeEnabledFeatures::webAnimationsEnabled())
- m_timeline->setZeroTimeAsPerfTime(m_documentTiming.domInteractive);
- }
break;
case Complete:
if (!m_documentTiming.domComplete)
@@ -1298,7 +1293,6 @@ void Document::updateTitle(const StringWithDirection& title)
m_rawTitle = title;
- StringWithDirection oldTitle = m_title;
if (m_rawTitle.string().isEmpty())
m_title = StringWithDirection();
else {
@@ -1307,11 +1301,8 @@ void Document::updateTitle(const StringWithDirection& title)
else
m_title = canonicalizedTitle<UChar>(this, m_rawTitle);
}
-
- if (!m_frame || oldTitle == m_title)
- return;
- m_frame->loader()->history()->setCurrentItemTitle(m_title);
- m_frame->loader()->client()->dispatchDidReceiveTitle(m_title);
+ if (Frame* f = frame())
+ f->loader()->setTitle(m_title);
}
void Document::setTitle(const String& title)
@@ -1680,10 +1671,8 @@ void Document::recalcStyle(StyleChange change)
m_inStyleRecalc = false;
// Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
- if (m_styleResolver) {
+ if (m_styleResolver)
m_styleSheetCollection->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
- m_styleResolver->clearStyleSharingList();
- }
if (frameView) {
frameView->resumeScheduledEvents();
@@ -1899,8 +1888,11 @@ void Document::detach(const AttachContext& context)
{
ASSERT(attached());
- if (page())
- page()->documentDetached(this);
+ if (page()) {
+ page()->pointerLockController()->documentDetached(this);
+ if (ValidationMessageClient* client = page()->validationMessageClient())
+ client->documentDetached(*this);
+ }
if (this == topDocument())
clearAXObjectCache();
@@ -2330,95 +2322,6 @@ void Document::implicitClose()
accessSVGExtensions()->startAnimations();
}
-bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, Document* navigatingDocument)
-{
- if (!m_domWindow)
- return true;
-
- if (!body())
- return true;
-
- RefPtr<Document> protect(this);
-
- RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create();
- m_loadEventProgress = BeforeUnloadEventInProgress;
- dispatchWindowEvent(beforeUnloadEvent.get(), this);
- m_loadEventProgress = BeforeUnloadEventCompleted;
- if (!beforeUnloadEvent->defaultPrevented())
- defaultEventHandler(beforeUnloadEvent.get());
- if (beforeUnloadEvent->result().isNull())
- return true;
-
- if (navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel) {
- addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation.");
- return true;
- }
-
- String text = displayStringModifiedByEncoding(beforeUnloadEvent->result());
- if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) {
- navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel = true;
- return true;
- }
- return false;
-}
-
-void Document::dispatchUnloadEvents()
-{
- RefPtr<Document> protect(this);
- if (m_parser)
- m_parser->stopParsing();
-
- if (m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEventInProgress) {
- Element* currentFocusedElement = focusedElement();
- if (currentFocusedElement && currentFocusedElement->hasTagName(inputTag))
- toHTMLInputElement(currentFocusedElement)->endEditing();
- if (m_loadEventProgress < PageHideInProgress) {
- m_loadEventProgress = PageHideInProgress;
- dispatchWindowEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), this);
- if (!m_frame)
- return;
-
- // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed
- // while dispatching the event, so protect it to prevent writing the end
- // time into freed memory.
- RefPtr<DocumentLoader> documentLoader = m_frame->loader()->provisionalDocumentLoader();
- m_loadEventProgress = UnloadEventInProgress;
- RefPtr<Event> unloadEvent(Event::create(eventNames().unloadEvent, false, false));
- if (documentLoader && !documentLoader->timing()->unloadEventStart() && !documentLoader->timing()->unloadEventEnd()) {
- DocumentLoadTiming* timing = documentLoader->timing();
- ASSERT(timing->navigationStart());
- timing->markUnloadEventStart();
- dispatchWindowEvent(unloadEvent, this);
- timing->markUnloadEventEnd();
- } else {
- m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->document());
- }
- }
- updateStyleIfNeeded();
- m_loadEventProgress = UnloadEventHandled;
- }
-
- if (!m_frame)
- return;
-
- // Don't remove event listeners from a transitional empty document (see https://bugs.webkit.org/show_bug.cgi?id=28716 for more information).
- bool keepEventListeners = m_frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->loader()->provisionalDocumentLoader()
- && isSecureTransitionTo(m_frame->loader()->provisionalDocumentLoader()->url());
- if (!keepEventListeners)
- removeAllEventListeners();
-}
-
-Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const
-{
- if (m_loadEventProgress == BeforeUnloadEventInProgress)
- return BeforeUnloadDismissal;
- if (m_loadEventProgress == PageHideInProgress)
- return PageHideDismissal;
- if (m_loadEventProgress == UnloadEventInProgress)
- return UnloadDismissal;
- return NoDismissal;
-}
-
void Document::setParsing(bool b)
{
m_bParsing = b;
@@ -2710,7 +2613,6 @@ Frame* Document::findUnsafeParentScrollPropagationBoundary()
void Document::seamlessParentUpdatedStylesheets()
{
- m_styleSheetCollection->didModifySeamlessParentStyleSheet();
styleResolverChanged(RecalcStyleImmediately);
}
@@ -4730,18 +4632,18 @@ void Document::webkitExitPointerLock()
{
if (!page())
return;
- if (Element* target = page()->pointerLockController().element()) {
+ if (Element* target = page()->pointerLockController()->element()) {
if (target->document() != this)
return;
}
- page()->pointerLockController().requestPointerUnlock();
+ page()->pointerLockController()->requestPointerUnlock();
}
Element* Document::webkitPointerLockElement() const
{
- if (!page() || page()->pointerLockController().lockPending())
+ if (!page() || page()->pointerLockController()->lockPending())
return 0;
- if (Element* element = page()->pointerLockController().element()) {
+ if (Element* element = page()->pointerLockController()->element()) {
if (element->document() == this)
return element;
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/Document.h b/chromium/third_party/WebKit/Source/core/dom/Document.h
index f6aadfd9832..cd905432eef 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Document.h
+++ b/chromium/third_party/WebKit/Source/core/dom/Document.h
@@ -67,7 +67,6 @@ class CSSStyleSheetResource;
class ScriptResource;
class CanvasRenderingContext;
class CharacterData;
-class Chrome;
class Comment;
class ContentSecurityPolicyResponseHeaders;
class ContextFeatures;
@@ -546,17 +545,6 @@ public:
// implicitClose() actually does the work of closing the input stream.
void implicitClose();
- bool dispatchBeforeUnloadEvent(Chrome&, Document* navigatingDocument);
- void dispatchUnloadEvents();
-
- enum PageDismissalType {
- NoDismissal = 0,
- BeforeUnloadDismissal = 1,
- PageHideDismissal = 2,
- UnloadDismissal = 3
- };
- PageDismissalType pageDismissalEventBeingDispatched() const;
-
void cancelParsing();
void write(const SegmentedString& text, Document* ownerDocument = 0);
@@ -766,8 +754,6 @@ public:
String title() const { return m_title.string(); }
void setTitle(const String&);
- const StringWithDirection& titleWithDirection() const { return m_title; }
-
Element* titleElement() const { return m_titleElement.get(); }
void setTitleElement(const StringWithDirection&, Element* titleElement);
void removeTitle(Element* titleElement);
@@ -928,15 +914,15 @@ public:
LoadEventTried,
LoadEventInProgress,
LoadEventCompleted,
- BeforeUnloadEventInProgress,
- BeforeUnloadEventCompleted,
- PageHideInProgress,
UnloadEventInProgress,
UnloadEventHandled
};
bool loadEventStillNeeded() const { return m_loadEventProgress == LoadEventNotRun; }
bool processingLoadEvent() const { return m_loadEventProgress == LoadEventInProgress; }
bool loadEventFinished() const { return m_loadEventProgress >= LoadEventCompleted; }
+ bool unloadEventStillNeeded() const { return m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEventInProgress; }
+ void unloadEventStarted() { m_loadEventProgress = UnloadEventInProgress; }
+ void unloadEventWasHandled() { m_loadEventProgress = UnloadEventHandled; }
virtual bool isContextThread() const;
virtual bool isJSExecutionForbidden() const { return false; }
@@ -1331,8 +1317,6 @@ private:
bool m_directionSetOnDocumentElement;
bool m_writingModeSetOnDocumentElement;
- bool m_didAllowNavigationViaBeforeUnloadConfirmationPanel;
-
DocumentTiming m_documentTiming;
RefPtr<MediaQueryMatcher> m_mediaQueryMatcher;
bool m_writeRecursionIsTooDeep;
diff --git a/chromium/third_party/WebKit/Source/core/dom/Document.idl b/chromium/third_party/WebKit/Source/core/dom/Document.idl
index c27623ad891..0fc91ba9df1 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Document.idl
+++ b/chromium/third_party/WebKit/Source/core/dom/Document.idl
@@ -33,10 +33,10 @@ callback CustomElementConstructor = Element ();
DocumentFragment createDocumentFragment();
[PerWorldBindings] Text createTextNode([Default=Undefined] optional DOMString data);
Comment createComment([Default=Undefined] optional DOMString data);
- [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4.
+ [RaisesException] CDATASection createCDATASection([Default=Undefined] optional DOMString data);
[RaisesException] ProcessingInstruction createProcessingInstruction([Default=Undefined] optional DOMString target,
[Default=Undefined] optional DOMString data);
- [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4.
+ [RaisesException] Attr createAttribute([Default=Undefined] optional DOMString name);
[PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname);
// Introduced in DOM Level 2:
@@ -45,19 +45,19 @@ callback CustomElementConstructor = Element ();
optional boolean deep);
[CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
- [RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
- [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); // Removed from DOM4.
+ [RaisesException] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+ [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[PerWorldBindings] Element getElementById([Default=Undefined] optional DOMString elementId);
// DOM Level 3 Core
- [TreatReturnedNullStringAs=Null, MeasureAs=DocumentInputEncoding] readonly attribute DOMString inputEncoding; // Removed from DOM4.
+ [TreatReturnedNullStringAs=Null] readonly attribute DOMString inputEncoding;
- [TreatReturnedNullStringAs=Null, MeasureAs=DocumentXMLEncoding] readonly attribute DOMString xmlEncoding; // Removed from DOM4.
- [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException, MeasureAs=DocumentXMLVersion] attribute DOMString xmlVersion; // Removed from DOM4.
- [SetterRaisesException, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
+ [TreatReturnedNullStringAs=Null] readonly attribute DOMString xmlEncoding;
+ [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException] attribute DOMString xmlVersion;
+ [SetterRaisesException] attribute boolean xmlStandalone;
[RaisesException, CustomElementCallbacks=Enable] Node adoptNode([Default=Undefined] optional Node source);
diff --git a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp
index 5e24213368a..74ef2b1164a 100644
--- a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp
@@ -37,8 +37,6 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/ProcessingInstruction.h"
-#include "core/dom/ShadowTreeStyleSheetCollection.h"
-#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/html/HTMLLinkElement.h"
#include "core/html/HTMLStyleElement.h"
@@ -65,7 +63,6 @@ DocumentStyleSheetCollection::DocumentStyleSheetCollection(Document* document)
, m_usesBeforeAfterRulesOverride(false)
, m_usesRemUnits(false)
, m_collectionForDocument(document)
- , m_needsDocumentStyleSheetsUpdate(true)
{
}
@@ -83,55 +80,6 @@ DocumentStyleSheetCollection::~DocumentStyleSheetCollection()
m_authorStyleSheets[i]->clearOwnerNode();
}
-void DocumentStyleSheetCollection::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeScope* treeScope)
-{
- if (treeScopes.isEmpty()) {
- treeScopes.add(treeScope);
- return;
- }
- if (treeScopes.contains(treeScope))
- return;
-
- TreeScopeSet::iterator begin = treeScopes.begin();
- TreeScopeSet::iterator end = treeScopes.end();
- TreeScopeSet::iterator it = end;
- TreeScope* followingTreeScope = 0;
- do {
- --it;
- TreeScope* n = *it;
- unsigned short position = n->comparePosition(treeScope);
- if (position & Node::DOCUMENT_POSITION_FOLLOWING) {
- treeScopes.insertBefore(followingTreeScope, treeScope);
- return;
- }
- followingTreeScope = n;
- } while (it != begin);
-
- treeScopes.insertBefore(followingTreeScope, treeScope);
-}
-
-StyleSheetCollection* DocumentStyleSheetCollection::ensureStyleSheetCollectionFor(TreeScope* treeScope)
-{
- if (treeScope == m_document)
- return &m_collectionForDocument;
-
- HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::AddResult result = m_styleSheetCollectionMap.add(treeScope, nullptr);
- if (result.isNewEntry)
- result.iterator->value = adoptPtr(new ShadowTreeStyleSheetCollection(toShadowRoot(treeScope)));
- return result.iterator->value.get();
-}
-
-StyleSheetCollection* DocumentStyleSheetCollection::styleSheetCollectionFor(TreeScope* treeScope)
-{
- if (treeScope == m_document)
- return &m_collectionForDocument;
-
- HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::iterator it = m_styleSheetCollectionMap.find(treeScope);
- if (it == m_styleSheetCollectionMap.end())
- return 0;
- return it->value.get();
-}
-
const Vector<RefPtr<StyleSheet> >& DocumentStyleSheetCollection::styleSheetsForStyleSheetList()
{
return m_collectionForDocument.styleSheetsForStyleSheetList();
@@ -142,19 +90,6 @@ const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::activeAuthor
return m_collectionForDocument.activeAuthorStyleSheets();
}
-void DocumentStyleSheetCollection::getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const
-{
- activeAuthorStyleSheets.append(&m_collectionForDocument.activeAuthorStyleSheets());
-
- HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::const_iterator::Values begin = m_styleSheetCollectionMap.values().begin();
- HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::const_iterator::Values end = m_styleSheetCollectionMap.values().end();
- HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::const_iterator::Values it = begin;
- for (; it != end; ++it) {
- const StyleSheetCollection* collection = it->get();
- activeAuthorStyleSheets.append(&collection->activeAuthorStyleSheets());
- }
-}
-
void DocumentStyleSheetCollection::combineCSSFeatureFlags(const RuleFeatureSet& features)
{
// Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/after).
@@ -253,7 +188,6 @@ void DocumentStyleSheetCollection::updateInjectedStyleSheetCache() const
void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
{
m_injectedStyleSheetCacheValid = false;
- m_needsDocumentStyleSheetsUpdate = true;
// FIXME: updateInjectedStyleSheetCache is called inside StyleSheetCollection::updateActiveStyleSheets
// and batch updates lots of sheets so we can't call addedStyleSheet() or removedStyleSheet().
m_document->styleResolverChanged(DeferRecalcStyle);
@@ -264,7 +198,6 @@ void DocumentStyleSheetCollection::addAuthorSheet(PassRefPtr<StyleSheetContents>
ASSERT(!authorSheet->isUserStyleSheet());
m_authorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_document));
m_document->addedStyleSheet(m_authorStyleSheets.last().get(), RecalcStyleImmediately);
- m_needsDocumentStyleSheetsUpdate = true;
}
void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
@@ -272,23 +205,16 @@ void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> u
ASSERT(userSheet->isUserStyleSheet());
m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document));
m_document->addedStyleSheet(m_userStyleSheets.last().get(), RecalcStyleImmediately);
- m_needsDocumentStyleSheetsUpdate = true;
}
// This method is called whenever a top-level stylesheet has finished loading.
-void DocumentStyleSheetCollection::removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType notification)
+void DocumentStyleSheetCollection::removePendingSheet(RemovePendingSheetNotificationType notification)
{
// Make sure we knew this sheet was pending, and that our count isn't out of sync.
ASSERT(m_pendingStylesheets > 0);
m_pendingStylesheets--;
- TreeScope* treeScope = isHTMLStyleElement(styleSheetCandidateNode) ? styleSheetCandidateNode->treeScope() : m_document;
- if (treeScope == m_document)
- m_needsDocumentStyleSheetsUpdate = true;
- else
- m_dirtyTreeScopes.add(treeScope);
-
if (m_pendingStylesheets)
return;
@@ -304,59 +230,21 @@ void DocumentStyleSheetCollection::removePendingSheet(Node* styleSheetCandidateN
void DocumentStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool createdByParser)
{
- if (!node->inDocument())
- return;
-
- TreeScope* treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_document;
- ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
-
- StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope);
- ASSERT(collection);
- collection->addStyleSheetCandidateNode(node, createdByParser);
-
- if (treeScope == m_document) {
- m_needsDocumentStyleSheetsUpdate = true;
- return;
- }
-
- insertTreeScopeInDocumentOrder(m_activeTreeScopes, treeScope);
- m_dirtyTreeScopes.add(treeScope);
+ m_collectionForDocument.addStyleSheetCandidateNode(node, createdByParser);
}
void DocumentStyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
{
- TreeScope* treeScope = scopingNode ? scopingNode->treeScope() : m_document;
- ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
-
- StyleSheetCollection* collection = styleSheetCollectionFor(treeScope);
- ASSERT(collection);
- collection->removeStyleSheetCandidateNode(node, scopingNode);
-
- if (treeScope == m_document) {
- m_needsDocumentStyleSheetsUpdate = true;
- return;
- }
- m_dirtyTreeScopes.add(treeScope);
- m_activeTreeScopes.remove(treeScope);
+ m_collectionForDocument.removeStyleSheetCandidateNode(node, scopingNode);
}
-void DocumentStyleSheetCollection::modifiedStyleSheetCandidateNode(Node* node)
+static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets)
{
- if (!node->inDocument())
- return;
-
- TreeScope* treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_document;
- ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
- if (treeScope == m_document) {
- m_needsDocumentStyleSheetsUpdate = true;
- return;
+ for (unsigned i = 0; i < sheets.size(); ++i) {
+ if (sheets[i]->contents()->usesRemUnits())
+ return true;
}
- m_dirtyTreeScopes.add(treeScope);
-}
-
-bool DocumentStyleSheetCollection::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode updateMode)
-{
- return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate;
+ return false;
}
bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
@@ -372,91 +260,18 @@ bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleResolverUpdateMo
if (!m_document->renderer() || !m_document->attached())
return false;
- bool requiresFullStyleRecalc = false;
- if (m_needsDocumentStyleSheetsUpdate || updateMode == FullStyleUpdate)
- requiresFullStyleRecalc = m_collectionForDocument.updateActiveStyleSheets(this, updateMode);
-
- if (shouldUpdateShadowTreeStyleSheetCollection(updateMode)) {
- TreeScopeSet treeScopes = updateMode == FullStyleUpdate ? m_activeTreeScopes : m_dirtyTreeScopes;
- HashSet<TreeScope*> treeScopesRemoved;
-
- for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) {
- TreeScope* treeScope = *it;
- ASSERT(treeScope != m_document);
- ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(treeScope));
- ASSERT(collection);
- collection->updateActiveStyleSheets(this, updateMode);
- if (!collection->hasStyleSheetCandidateNodes())
- treeScopesRemoved.add(treeScope);
- }
- if (!treeScopesRemoved.isEmpty())
- for (HashSet<TreeScope*>::iterator it = treeScopesRemoved.begin(); it != treeScopesRemoved.end(); ++it)
- m_activeTreeScopes.remove(*it);
- m_dirtyTreeScopes.clear();
- }
-
- if (StyleResolver* styleResolver = m_document->styleResolverIfExists()) {
- styleResolver->finishAppendAuthorStyleSheets();
- resetCSSFeatureFlags(styleResolver->ruleFeatureSet());
- }
-
+ StyleSheetCollection::StyleResolverUpdateType styleResolverUpdateType;
+ bool requiresFullStyleRecalc = m_collectionForDocument.updateActiveStyleSheets(this, updateMode, styleResolverUpdateType);
m_needsUpdateActiveStylesheetsOnStyleRecalc = false;
- activeStyleSheetsUpdatedForInspector();
- m_usesRemUnits = m_collectionForDocument.usesRemUnits();
-
- if (m_needsDocumentStyleSheetsUpdate || updateMode == FullStyleUpdate) {
- m_document->notifySeamlessChildDocumentsOfStylesheetUpdate();
- m_needsDocumentStyleSheetsUpdate = false;
- }
-
- return requiresFullStyleRecalc;
-}
-
-void DocumentStyleSheetCollection::activeStyleSheetsUpdatedForInspector()
-{
- if (m_activeTreeScopes.isEmpty()) {
- InspectorInstrumentation::activeStyleSheetsUpdated(m_document, m_collectionForDocument.styleSheetsForStyleSheetList());
- return;
- }
- Vector<RefPtr<StyleSheet> > activeStyleSheets;
- activeStyleSheets.append(m_collectionForDocument.styleSheetsForStyleSheetList());
+ if (styleResolverUpdateType != StyleSheetCollection::Reconstruct)
+ resetCSSFeatureFlags(m_document->styleResolver()->ruleFeatureSet());
- TreeScopeSet::iterator begin = m_activeTreeScopes.begin();
- TreeScopeSet::iterator end = m_activeTreeScopes.end();
- for (TreeScopeSet::iterator it = begin; it != end; ++it) {
- if (StyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it))
- activeStyleSheets.append(collection->styleSheetsForStyleSheetList());
- }
+ InspectorInstrumentation::activeStyleSheetsUpdated(m_document, m_collectionForDocument.styleSheetsForStyleSheetList());
+ m_usesRemUnits = styleSheetsUseRemUnits(m_collectionForDocument.activeAuthorStyleSheets());
+ m_document->notifySeamlessChildDocumentsOfStylesheetUpdate();
- // FIXME: Inspector needs a vector which has all active stylesheets.
- // However, creating such a large vector might cause performance regression.
- // Need to implement some smarter solution.
- InspectorInstrumentation::activeStyleSheetsUpdated(m_document, activeStyleSheets);
-}
-
-void DocumentStyleSheetCollection::didRemoveShadowRoot(ShadowRoot* shadowRoot)
-{
- m_styleSheetCollectionMap.remove(shadowRoot);
-}
-
-void DocumentStyleSheetCollection::appendActiveAuthorStyleSheets(StyleResolver* styleResolver)
-{
- ASSERT(styleResolver);
-
- styleResolver->setBuildScopedStyleTreeInDocumentOrder(true);
- styleResolver->appendAuthorStyleSheets(0, m_collectionForDocument.activeAuthorStyleSheets());
-
- TreeScopeSet::iterator begin = m_activeTreeScopes.begin();
- TreeScopeSet::iterator end = m_activeTreeScopes.end();
- for (TreeScopeSet::iterator it = begin; it != end; ++it) {
- if (StyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it)) {
- styleResolver->setBuildScopedStyleTreeInDocumentOrder(!collection->scopingNodesForStyleScoped());
- styleResolver->appendAuthorStyleSheets(0, collection->activeAuthorStyleSheets());
- }
- }
- styleResolver->finishAppendAuthorStyleSheets();
- styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
+ return requiresFullStyleRecalc;
}
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h
index 2dd47c549f7..bbafeb858e6 100644
--- a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h
+++ b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h
@@ -64,7 +64,6 @@ public:
void addStyleSheetCandidateNode(Node*, bool createdByParser);
void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode = 0);
- void modifiedStyleSheetCandidateNode(Node*);
void clearPageUserSheet();
void updatePageUserSheet();
@@ -88,7 +87,7 @@ public:
RemovePendingSheetNotifyImmediately,
RemovePendingSheetNotifyLater
};
- void removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
+ void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
bool hasPendingSheets() const { return m_pendingStylesheets > 0; }
@@ -106,22 +105,9 @@ public:
void combineCSSFeatureFlags(const RuleFeatureSet&);
void resetCSSFeatureFlags(const RuleFeatureSet&);
- void didModifySeamlessParentStyleSheet() { m_needsDocumentStyleSheetsUpdate = true; }
- void didRemoveShadowRoot(ShadowRoot*);
- void appendActiveAuthorStyleSheets(StyleResolver*);
- void getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const;
-
private:
DocumentStyleSheetCollection(Document*);
- StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope*);
- StyleSheetCollection* styleSheetCollectionFor(TreeScope*);
- void activeStyleSheetsUpdatedForInspector();
- bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode);
-
- typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
- static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*);
-
Document* m_document;
// Track the number of currently loading top-level stylesheets needed for rendering.
@@ -139,14 +125,10 @@ private:
Vector<RefPtr<CSSStyleSheet> > m_userStyleSheets;
Vector<RefPtr<CSSStyleSheet> > m_authorStyleSheets;
+ bool m_hadActiveLoadingStylesheet;
bool m_needsUpdateActiveStylesheetsOnStyleRecalc;
- StyleSheetCollectionForDocument m_collectionForDocument;
- HashMap<TreeScope*, OwnPtr<StyleSheetCollection> > m_styleSheetCollectionMap;
-
- TreeScopeSet m_dirtyTreeScopes;
- TreeScopeSet m_activeTreeScopes;
- bool m_needsDocumentStyleSheetsUpdate;
+ StyleSheetCollection m_collectionForDocument;
String m_preferredStylesheetSetName;
String m_selectedStylesheetSetName;
diff --git a/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl b/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl
index 510240a1362..8f192f3f562 100644
--- a/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl
+++ b/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl
@@ -22,14 +22,14 @@ interface DocumentType : Node {
// DOM Level 1
readonly attribute DOMString name;
- [MeasureAs=DocumentTypeEntities] readonly attribute NamedNodeMap entities; // Removed from DOM4.
- [MeasureAs=DocumentTypeNotations] readonly attribute NamedNodeMap notations; // Removed from DOM4.
+ readonly attribute NamedNodeMap entities;
+ readonly attribute NamedNodeMap notations;
// DOM Level 2
[TreatReturnedNullStringAs=Null] readonly attribute DOMString publicId;
[TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId;
- [TreatReturnedNullStringAs=Null, MeasureAs=DocumentTypeInternalSubset] readonly attribute DOMString internalSubset; // Removed from DOM4.
+ [TreatReturnedNullStringAs=Null] readonly attribute DOMString internalSubset;
};
DocumentType implements ChildNode;
diff --git a/chromium/third_party/WebKit/Source/core/dom/Element.cpp b/chromium/third_party/WebKit/Source/core/dom/Element.cpp
index ade43c82f1f..b7147bcdc82 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1279,7 +1279,7 @@ void Element::removedFrom(ContainerNode* insertionPoint)
setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
if (document()->page())
- document()->page()->pointerLockController().elementRemoved(this);
+ document()->page()->pointerLockController()->elementRemoved(this);
setSavedLayerScrollOffset(IntSize());
@@ -1318,16 +1318,6 @@ void Element::attach(const AttachContext& context)
StyleResolverParentPusher parentPusher(this);
WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
- // We've already been through detach when doing a lazyAttach, but we might
- // need to clear any state that's been added since then.
- if (hasRareData() && styleChangeType() == LazyAttachStyleChange) {
- ElementRareData* data = elementRareData();
- data->clearComputedStyle();
- data->resetDynamicRestyleObservations();
- if (!context.resolvedStyle)
- data->resetStyleState();
- }
-
NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIfNeeded();
createPseudoElementIfNeeded(BEFORE);
@@ -1511,9 +1501,6 @@ bool Element::recalcStyle(StyleChange change)
change = Force;
else if (change != Force)
change = localChange;
- } else {
- // We still want to seed the style sharing list when just walking the tree to maximize sharing.
- document()->styleResolver()->addToStyleSharingList(this);
}
StyleResolverParentPusher parentPusher(this);
@@ -1547,11 +1534,10 @@ bool Element::recalcStyle(StyleChange change)
} else if (child->isElementNode()) {
Element* element = toElement(child);
- bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange;
-
if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling)
element->setNeedsStyleRecalc();
+ bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange;
forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
@@ -1642,6 +1628,12 @@ ShadowRoot* Element::ensureUserAgentShadowRoot()
return shadowRoot;
}
+Element* Element::uaShadowElementById(const AtomicString& id) const
+{
+ ShadowRoot* shadowRoot = userAgentShadowRoot();
+ return shadowRoot ? shadowRoot->getElementById(id) : 0;
+}
+
bool Element::supportsShadowElementForUserAgentShadow() const
{
return true;
@@ -2638,7 +2630,7 @@ void Element::setIsInTopLayer(bool inTopLayer)
void Element::webkitRequestPointerLock()
{
if (document()->page())
- document()->page()->pointerLockController().requestPointerLock(this);
+ document()->page()->pointerLockController()->requestPointerLock(this);
}
SpellcheckAttributeState Element::spellcheckAttributeState() const
diff --git a/chromium/third_party/WebKit/Source/core/dom/Element.h b/chromium/third_party/WebKit/Source/core/dom/Element.h
index f90ed9e58dd..7b075ce8638 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Element.h
+++ b/chromium/third_party/WebKit/Source/core/dom/Element.h
@@ -446,6 +446,7 @@ public:
ShadowRoot* userAgentShadowRoot() const;
ShadowRoot* ensureUserAgentShadowRoot();
+ Element* uaShadowElementById(const AtomicString& id) const;
virtual bool supportsShadowElementForUserAgentShadow() const;
virtual const AtomicString& shadowPseudoId() const { return !part().isEmpty() ? part() : pseudo(); }
diff --git a/chromium/third_party/WebKit/Source/core/dom/Element.idl b/chromium/third_party/WebKit/Source/core/dom/Element.idl
index 72241970591..0137af97e90 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Element.idl
+++ b/chromium/third_party/WebKit/Source/core/dom/Element.idl
@@ -30,9 +30,9 @@
[RaisesException, CustomElementCallbacks=Enable] void setAttribute([Default=Undefined] optional DOMString name,
[Default=Undefined] optional DOMString value);
[CustomElementCallbacks=Enable] void removeAttribute([Default=Undefined] optional DOMString name);
- [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4.
- [RaisesException, CustomElementCallbacks=Enable, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
- [RaisesException, CustomElementCallbacks=Enable, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4.
+ Attr getAttributeNode([Default=Undefined] optional DOMString name);
+ [RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
+ [RaisesException, CustomElementCallbacks=Enable] 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.
@@ -50,8 +50,8 @@
DOMString localName);
NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
- [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
- [Default=Undefined] optional DOMString localName); // Removed from DOM4.
+ Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+ [Default=Undefined] optional DOMString localName);
[RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
boolean hasAttribute(DOMString name);
boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
diff --git a/chromium/third_party/WebKit/Source/core/dom/Node.cpp b/chromium/third_party/WebKit/Source/core/dom/Node.cpp
index 981e4afc5c4..39360244d6c 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/Node.cpp
@@ -1030,33 +1030,6 @@ bool Node::containsIncludingHostElements(const Node* node) const
return false;
}
-inline void Node::detachNode(Node* root, const AttachContext& context)
-{
- Node* node = root;
- while (node) {
- if (node->styleChangeType() == LazyAttachStyleChange) {
- // FIXME: This is needed because Node::lazyAttach marks nodes as being attached even
- // though they've never been through attach(). This allows us to avoid doing all the
- // virtual calls to detach() and other associated work.
- node->clearAttached();
- node->clearChildNeedsStyleRecalc();
-
- for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot())
- detachNode(shadowRoot, context);
-
- node = NodeTraversal::next(node, root);
- continue;
- }
- // Handle normal reattaches from style recalc (ex. display type changes)
- // or descendants of lazy attached nodes that got actually attached, for example,
- // by innerHTML or editing.
- // FIXME: innerHTML and editing should also lazyAttach.
- if (node->attached())
- node->detach(context);
- node = NodeTraversal::nextSkippingChildren(node, root);
- }
-}
-
void Node::reattach(const AttachContext& context)
{
// FIXME: Text::updateTextRenderer calls reattach outside a style recalc.
@@ -1064,7 +1037,8 @@ void Node::reattach(const AttachContext& context)
AttachContext reattachContext(context);
reattachContext.performingReattach = true;
- detachNode(this, reattachContext);
+ if (attached())
+ detach(reattachContext);
attach(reattachContext);
}
@@ -1136,7 +1110,7 @@ void Node::detach(const AttachContext& context)
}
}
- clearAttached();
+ clearFlag(IsAttachedFlag);
#ifndef NDEBUG
detachingNode = 0;
@@ -2490,8 +2464,9 @@ void Node::defaultEventHandler(Event* event)
if (dispatchDOMActivateEvent(detail, event))
event->setDefaultHandled();
} else if (eventType == eventNames().contextmenuEvent) {
- if (Page* page = document()->page())
- page->contextMenuController().handleContextMenuEvent(event);
+ if (Frame* frame = document()->frame())
+ if (Page* page = frame->page())
+ page->contextMenuController()->handleContextMenuEvent(event);
} else if (eventType == eventNames().textInputEvent) {
if (event->hasInterface(eventNames().interfaceForTextEvent))
if (Frame* frame = document()->frame())
@@ -2648,14 +2623,15 @@ PassRefPtr<NodeList> Node::getDestinationInsertionPoints()
document()->updateDistributionForNodeIfNeeded(this);
Vector<InsertionPoint*, 8> insertionPoints;
collectInsertionPointsWhereNodeIsDistributed(this, insertionPoints);
- Vector<RefPtr<Node> > filteredInsertionPoints;
for (size_t i = 0; i < insertionPoints.size(); ++i) {
InsertionPoint* insertionPoint = insertionPoints[i];
ASSERT(insertionPoint->containingShadowRoot());
- if (insertionPoint->containingShadowRoot()->type() != ShadowRoot::UserAgentShadowRoot)
- filteredInsertionPoints.append(insertionPoint);
+ if (insertionPoint->containingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot)
+ return StaticNodeList::createEmpty();
}
- return StaticNodeList::adopt(filteredInsertionPoints);
+ Vector<RefPtr<Node> > asNodes;
+ asNodes.appendRange(insertionPoints.begin(), insertionPoints.end());
+ return StaticNodeList::adopt(asNodes);
}
void Node::registerScopedHTMLStyleChild()
diff --git a/chromium/third_party/WebKit/Source/core/dom/Node.h b/chromium/third_party/WebKit/Source/core/dom/Node.h
index 92a02e3713a..a651d060e69 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Node.h
+++ b/chromium/third_party/WebKit/Source/core/dom/Node.h
@@ -839,9 +839,6 @@ private:
void setStyleChange(StyleChangeType);
- void detachNode(Node*, const AttachContext&);
- void clearAttached() { clearFlag(IsAttachedFlag); }
-
// Used to share code between lazyAttach and setNeedsStyleRecalc.
void markAncestorsWithChildNeedsStyleRecalc();
diff --git a/chromium/third_party/WebKit/Source/core/dom/Node.idl b/chromium/third_party/WebKit/Source/core/dom/Node.idl
index 55643f02a63..0c7c5a12526 100644
--- a/chromium/third_party/WebKit/Source/core/dom/Node.idl
+++ b/chromium/third_party/WebKit/Source/core/dom/Node.idl
@@ -61,11 +61,11 @@
[CustomElementCallbacks=Enable] void normalize();
// Introduced in DOM Level 2:
- [MeasureAs=NodeIsSupported] boolean isSupported([Default=Undefined] optional DOMString feature,
- [TreatNullAs=NullString,Default=Undefined] optional DOMString version); // Removed in DOM4.
+ boolean isSupported([Default=Undefined] optional DOMString feature,
+ [TreatNullAs=NullString,Default=Undefined] optional DOMString version);
- [TreatReturnedNullStringAs=Null, PerWorldBindings, MeasureAs=NodeNamespaceURI] readonly attribute DOMString namespaceURI; // Removed from DOM4.
- [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, MeasureAs=NodePrefix] attribute DOMString prefix; // Removed from DOM4.
+ [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI;
+ [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException] attribute DOMString prefix;
[TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName;
// Introduced in DOM Level 3:
@@ -74,7 +74,7 @@
// FIXME: the spec says this can also raise on retrieval.
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, CustomElementCallbacks=Enable] attribute DOMString textContent;
- [MeasureAs=NodeIsSameNode] boolean isSameNode([Default=Undefined] optional Node other); // Removed in DOM4.
+ boolean isSameNode([Default=Undefined] optional Node other);
boolean isEqualNode([Default=Undefined] optional Node other);
[TreatReturnedNullStringAs=Null] DOMString lookupPrefix([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI);
boolean isDefaultNamespace([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI);
diff --git a/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp b/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp
index 6ad05cfed0e..aab3343f3fe 100644
--- a/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp
@@ -27,7 +27,7 @@
#include "core/dom/PendingScript.h"
#include "core/dom/Element.h"
-#include "core/fetch/ScriptResource.h"
+#include "core/loader/cache/ScriptResource.h"
namespace WebCore {
diff --git a/chromium/third_party/WebKit/Source/core/dom/PendingScript.h b/chromium/third_party/WebKit/Source/core/dom/PendingScript.h
index 0f169a9cabe..bf902b21987 100644
--- a/chromium/third_party/WebKit/Source/core/dom/PendingScript.h
+++ b/chromium/third_party/WebKit/Source/core/dom/PendingScript.h
@@ -26,8 +26,8 @@
#ifndef PendingScript_h
#define PendingScript_h
-#include "core/fetch/ResourceClient.h"
-#include "core/fetch/ResourcePtr.h"
+#include "core/loader/cache/ResourceClient.h"
+#include "core/loader/cache/ResourcePtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/text/TextPosition.h"
diff --git a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
index cf915dc2dc7..def6f8efa93 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
@@ -27,10 +27,10 @@
#include "core/css/StyleSheetContents.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentStyleSheetCollection.h"
-#include "core/fetch/CSSStyleSheetResource.h"
-#include "core/fetch/FetchRequest.h"
-#include "core/fetch/ResourceFetcher.h"
-#include "core/fetch/XSLStyleSheetResource.h"
+#include "core/loader/cache/CSSStyleSheetResource.h"
+#include "core/loader/cache/FetchRequest.h"
+#include "core/loader/cache/ResourceFetcher.h"
+#include "core/loader/cache/XSLStyleSheetResource.h"
#include "core/xml/XSLStyleSheet.h"
#include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes()
@@ -170,7 +170,7 @@ void ProcessingInstruction::checkStyleSheet()
else {
// The request may have been denied if (for example) the stylesheet is local and the document is remote.
m_loading = false;
- document()->styleSheetCollection()->removePendingSheet(this);
+ document()->styleSheetCollection()->removePendingSheet();
}
}
}
@@ -188,7 +188,7 @@ bool ProcessingInstruction::isLoading() const
bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
- document()->styleSheetCollection()->removePendingSheet(this);
+ document()->styleSheetCollection()->removePendingSheet();
return true;
}
return false;
diff --git a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h
index d8c837bcff9..1ae797633e1 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h
+++ b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h
@@ -23,8 +23,8 @@
#define ProcessingInstruction_h
#include "core/dom/Node.h"
-#include "core/fetch/ResourcePtr.h"
-#include "core/fetch/StyleSheetResourceClient.h"
+#include "core/loader/cache/ResourcePtr.h"
+#include "core/loader/cache/StyleSheetResourceClient.h"
namespace WebCore {
diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
index 55d6844df0d..6d1c06b4b70 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -35,12 +35,12 @@
#include "core/dom/ScriptRunner.h"
#include "core/dom/ScriptableDocumentParser.h"
#include "core/dom/Text.h"
-#include "core/fetch/FetchRequest.h"
-#include "core/fetch/ResourceFetcher.h"
-#include "core/fetch/ScriptResource.h"
#include "core/html/HTMLImport.h"
#include "core/html/HTMLScriptElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
+#include "core/loader/cache/FetchRequest.h"
+#include "core/loader/cache/ResourceFetcher.h"
+#include "core/loader/cache/ScriptResource.h"
#include "core/page/ContentSecurityPolicy.h"
#include "core/page/Frame.h"
#include "core/platform/MIMETypeRegistry.h"
diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h
index dfa88184585..390d83a2f89 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h
+++ b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h
@@ -21,8 +21,8 @@
#ifndef ScriptLoader_h
#define ScriptLoader_h
-#include "core/fetch/ResourceClient.h"
-#include "core/fetch/ResourcePtr.h"
+#include "core/loader/cache/ResourceClient.h"
+#include "core/loader/cache/ResourcePtr.h"
#include "wtf/text/TextPosition.h"
#include "wtf/text/WTFString.h"
diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
index f63ab5056c0..d25001e0f42 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -30,7 +30,7 @@
#include "core/dom/Element.h"
#include "core/dom/PendingScript.h"
#include "core/dom/ScriptLoader.h"
-#include "core/fetch/ScriptResource.h"
+#include "core/loader/cache/ScriptResource.h"
namespace WebCore {
diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h
index b793589a8e8..ef9e270b5c9 100644
--- a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h
+++ b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h
@@ -26,7 +26,7 @@
#ifndef ScriptRunner_h
#define ScriptRunner_h
-#include "core/fetch/ResourcePtr.h"
+#include "core/loader/cache/ResourcePtr.h"
#include "core/platform/Timer.h"
#include "wtf/HashMap.h"
#include "wtf/Noncopyable.h"
diff --git a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp b/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
deleted file mode 100644
index 2c53a058c09..00000000000
--- a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/ShadowTreeStyleSheetCollection.h"
-
-#include "HTMLNames.h"
-#include "core/css/CSSStyleSheet.h"
-#include "core/css/resolver/StyleResolver.h"
-#include "core/dom/Document.h"
-#include "core/dom/DocumentStyleSheetCollection.h"
-#include "core/dom/Element.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "core/html/HTMLStyleElement.h"
-#include "core/page/Settings.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot* shadowRoot)
- : StyleSheetCollection(shadowRoot)
-{
-}
-
-void ShadowTreeStyleSheetCollection::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
-{
- if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled())
- return;
-
- DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
- DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
- for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
- Node* node = *it;
- StyleSheet* sheet = 0;
- CSSStyleSheet* activeSheet = 0;
-
- if (!node->isHTMLElement() || !node->hasTagName(styleTag))
- continue;
-
- Element* element = toElement(node);
- AtomicString title = element->getAttribute(titleAttr);
- bool enabledViaScript = false;
-
- sheet = static_cast<HTMLStyleElement*>(node)->sheet();
- if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
- activeSheet = static_cast<CSSStyleSheet*>(sheet);
-
- // FIXME: clarify how PREFERRED or ALTERNATE works in shadow trees.
- // Should we set preferred/selected stylesheets name in shadow trees and
- // use the name in document?
- AtomicString rel = element->getAttribute(relAttr);
- if (!enabledViaScript && sheet && !title.isEmpty()) {
- if (collections->preferredStylesheetSetName().isEmpty()) {
- if (element->hasLocalName(styleTag) || !rel.contains("alternate")) {
- collections->setPreferredStylesheetSetName(title);
- collections->setSelectedStylesheetSetName(title);
- }
- }
- if (title != collections->preferredStylesheetSetName())
- activeSheet = 0;
- }
-
- if (rel.contains("alternate") && title.isEmpty())
- activeSheet = 0;
-
- if (sheet)
- styleSheets.append(sheet);
- if (activeSheet)
- activeSheets.append(activeSheet);
- }
-}
-
-bool ShadowTreeStyleSheetCollection::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode)
-{
- Vector<RefPtr<StyleSheet> > styleSheets;
- Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
- collectStyleSheets(collections, styleSheets, activeCSSStyleSheets);
-
- bool requiresFullStyleRecalc = true;
-
- // If we have already decided to destroy StyleResolver, we don't need to analyze. Reconstruction will take care.
- if (StyleResolver* styleResolver = document()->styleResolverIfExists()) {
- StyleResolverUpdateType styleResolverUpdateType;
-
- analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
-
- // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder.
- // Need to change "false" to some valid condition.
- styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
- if (styleResolverUpdateType == Reset || styleResolverUpdateType == Reconstruct) {
- // We should not destroy StyleResolver when we find any stylesheet update in a shadow tree.
- // In this case, we will reset rulesets created from style elements in the shadow tree.
- resetAllRuleSetsInTreeScope(styleResolver);
- styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets);
- } else {
- ASSERT(styleResolverUpdateType == Additive);
- styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets);
- }
- }
- m_scopingNodesForStyleScoped.didRemoveScopingNodes();
- m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
- m_styleSheetsForStyleSheetList.swap(styleSheets);
- updateUsesRemUnits();
-
- return requiresFullStyleRecalc;
-}
-
-}
diff --git a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h b/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h
deleted file mode 100644
index e3984406ef3..00000000000
--- a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2001 Dirk Mueller (mueller@kde.org)
- * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ShadowTreeStyleSheetCollection_h
-#define ShadowTreeStyleSheetCollection_h
-
-#include "core/dom/StyleSheetCollection.h"
-
-namespace WebCore {
-
-class CSSStyleSheet;
-class DocumentStyleSheetCollection;
-class ShadowRoot;
-class StyleSheet;
-class StyleSheetCollection;
-
-class ShadowTreeStyleSheetCollection FINAL : public StyleSheetCollection {
- WTF_MAKE_NONCOPYABLE(ShadowTreeStyleSheetCollection); WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit ShadowTreeStyleSheetCollection(ShadowRoot*);
-
- bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode);
-
-private:
- void collectStyleSheets(DocumentStyleSheetCollection*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
-};
-
-}
-
-#endif
-
diff --git a/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp b/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp
index 8f31ee46d6d..0320d1670ee 100644
--- a/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp
@@ -127,7 +127,7 @@ void StyleElement::createSheet(Element* e, const String& text)
Document* document = e->document();
if (m_sheet) {
if (m_sheet->isLoading())
- document->styleSheetCollection()->removePendingSheet(e);
+ document->styleSheetCollection()->removePendingSheet();
clearSheet();
}
@@ -169,7 +169,7 @@ bool StyleElement::sheetLoaded(Document* document)
if (isLoading())
return false;
- document->styleSheetCollection()->removePendingSheet(m_sheet->ownerNode());
+ document->styleSheetCollection()->removePendingSheet();
return true;
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp
index a665b8074de..80ca3d2a967 100644
--- a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp
@@ -37,11 +37,13 @@
#include "core/dom/DocumentStyleSheetCollection.h"
#include "core/dom/Element.h"
#include "core/dom/ProcessingInstruction.h"
-#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/html/HTMLLinkElement.h"
#include "core/html/HTMLStyleElement.h"
+#include "core/page/Page.h"
+#include "core/page/PageGroup.h"
#include "core/page/Settings.h"
+#include "core/page/UserContentURLPattern.h"
#include "core/svg/SVGStyleElement.h"
namespace WebCore {
@@ -84,115 +86,7 @@ void StyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNo
m_scopingNodesForStyleScoped.remove(scopingNode);
}
-StyleSheetCollection::StyleResolverUpdateType StyleSheetCollection::compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets)
-{
- // Find out which stylesheets are new.
- unsigned newStylesheetCount = newStylesheets.size();
- unsigned oldStylesheetCount = oldStyleSheets.size();
- if (newStylesheetCount < oldStylesheetCount)
- return Reconstruct;
-
- unsigned newIndex = 0;
- for (unsigned oldIndex = 0; oldIndex < oldStylesheetCount; ++oldIndex) {
- if (newIndex >= newStylesheetCount)
- return Reconstruct;
- while (oldStyleSheets[oldIndex] != newStylesheets[newIndex]) {
- addedSheets.append(newStylesheets[newIndex]->contents());
- ++newIndex;
- if (newIndex == newStylesheetCount)
- return Reconstruct;
- }
- ++newIndex;
- }
- bool hasInsertions = !addedSheets.isEmpty();
- while (newIndex < newStylesheetCount) {
- addedSheets.append(newStylesheets[newIndex]->contents());
- ++newIndex;
- }
- // If all new sheets were added at the end of the list we can just add them to existing StyleResolver.
- // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly.
- return hasInsertions ? Reset : Additive;
-}
-
-bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets)
-{
- // StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
- bool hasActiveLoadingStylesheet = false;
- unsigned newStylesheetCount = newStyleSheets.size();
- for (unsigned i = 0; i < newStylesheetCount; ++i) {
- if (newStyleSheets[i]->isLoading())
- hasActiveLoadingStylesheet = true;
- }
- if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
- m_hadActiveLoadingStylesheet = false;
- return true;
- }
- m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
- return false;
-}
-
-void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc)
-{
- styleResolverUpdateType = Reconstruct;
- requiresFullStyleRecalc = true;
-
- if (activeLoadingStyleSheetLoaded(newStyleSheets))
- return;
-
- if (updateMode != AnalyzedStyleUpdate)
- return;
- if (!document()->styleResolverIfExists())
- return;
-
- // Find out which stylesheets are new.
- Vector<StyleSheetContents*> addedSheets;
- styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets);
-
- // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
- if (!document()->body() || document()->hasNodesWithPlaceholderStyle())
- return;
- StyleInvalidationAnalysis invalidationAnalysis(addedSheets);
- if (invalidationAnalysis.dirtiesAllStyle())
- return;
- invalidationAnalysis.invalidateStyle(document());
- requiresFullStyleRecalc = false;
-}
-
-void StyleSheetCollection::resetAllRuleSetsInTreeScope(StyleResolver* styleResolver)
-{
- // FIXME: If many web developers use style scoped, implement reset RuleSets in per-scoping node manner.
- if (DocumentOrderedList* styleScopedScopingNodes = scopingNodesForStyleScoped()) {
- for (DocumentOrderedList::iterator it = styleScopedScopingNodes->begin(); it != styleScopedScopingNodes->end(); ++it)
- styleResolver->resetAuthorStyle(toContainerNode(*it));
- }
- if (ListHashSet<Node*, 4>* removedNodes = scopingNodesRemoved()) {
- for (ListHashSet<Node*, 4>::iterator it = removedNodes->begin(); it != removedNodes->end(); ++it)
- styleResolver->resetAuthorStyle(toContainerNode(*it));
- }
- styleResolver->resetAuthorStyle(toContainerNode(m_treeScope->rootNode()));
-}
-
-static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets)
-{
- for (unsigned i = 0; i < sheets.size(); ++i) {
- if (sheets[i]->contents()->usesRemUnits())
- return true;
- }
- return false;
-}
-
-void StyleSheetCollection::updateUsesRemUnits()
-{
- m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
-}
-
-StyleSheetCollectionForDocument::StyleSheetCollectionForDocument(TreeScope* treeScope)
- : StyleSheetCollection(treeScope)
-{
- ASSERT(treeScope->rootNode() == treeScope->rootNode()->document());
-}
-
-void StyleSheetCollectionForDocument::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
+void StyleSheetCollection::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
{
if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled())
return;
@@ -279,6 +173,80 @@ void StyleSheetCollectionForDocument::collectStyleSheets(DocumentStyleSheetColle
}
}
+StyleSheetCollection::StyleResolverUpdateType StyleSheetCollection::compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets)
+{
+ // Find out which stylesheets are new.
+ unsigned newStylesheetCount = newStylesheets.size();
+ unsigned oldStylesheetCount = oldStyleSheets.size();
+ if (newStylesheetCount < oldStylesheetCount)
+ return Reconstruct;
+
+ unsigned newIndex = 0;
+ for (unsigned oldIndex = 0; oldIndex < oldStylesheetCount; ++oldIndex) {
+ if (newIndex >= newStylesheetCount)
+ return Reconstruct;
+ while (oldStyleSheets[oldIndex] != newStylesheets[newIndex]) {
+ addedSheets.append(newStylesheets[newIndex]->contents());
+ ++newIndex;
+ if (newIndex == newStylesheetCount)
+ return Reconstruct;
+ }
+ ++newIndex;
+ }
+ bool hasInsertions = !addedSheets.isEmpty();
+ while (newIndex < newStylesheetCount) {
+ addedSheets.append(newStylesheets[newIndex]->contents());
+ ++newIndex;
+ }
+ // If all new sheets were added at the end of the list we can just add them to existing StyleResolver.
+ // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly.
+ return hasInsertions ? Reset : Additive;
+}
+
+bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets)
+{
+ // StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
+ bool hasActiveLoadingStylesheet = false;
+ unsigned newStylesheetCount = newStyleSheets.size();
+ for (unsigned i = 0; i < newStylesheetCount; ++i) {
+ if (newStyleSheets[i]->isLoading())
+ hasActiveLoadingStylesheet = true;
+ }
+ if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
+ m_hadActiveLoadingStylesheet = false;
+ return true;
+ }
+ m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
+ return false;
+}
+
+void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc)
+{
+ styleResolverUpdateType = Reconstruct;
+ requiresFullStyleRecalc = true;
+
+ if (activeLoadingStyleSheetLoaded(newStyleSheets))
+ return;
+
+ if (updateMode != AnalyzedStyleUpdate)
+ return;
+ if (!document()->styleResolverIfExists())
+ return;
+
+ // Find out which stylesheets are new.
+ Vector<StyleSheetContents*> addedSheets;
+ styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets);
+
+ // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
+ if (!document()->body() || document()->hasNodesWithPlaceholderStyle())
+ return;
+ StyleInvalidationAnalysis invalidationAnalysis(addedSheets);
+ if (invalidationAnalysis.dirtiesAllStyle())
+ return;
+ invalidationAnalysis.invalidateStyle(document());
+ requiresFullStyleRecalc = false;
+}
+
static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyleSheet> >& sheets, Document* document)
{
HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
@@ -287,7 +255,7 @@ static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyl
sheets.append(seamlessParentIFrame->document()->styleSheetCollection()->activeAuthorStyleSheets());
}
-bool StyleSheetCollectionForDocument::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode)
+bool StyleSheetCollection::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode, StyleResolverUpdateType& styleResolverUpdateType)
{
Vector<RefPtr<StyleSheet> > styleSheets;
Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
@@ -296,20 +264,25 @@ bool StyleSheetCollectionForDocument::updateActiveStyleSheets(DocumentStyleSheet
collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, document());
collectStyleSheets(collections, styleSheets, activeCSSStyleSheets);
- StyleResolverUpdateType styleResolverUpdateType;
bool requiresFullStyleRecalc;
analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
if (styleResolverUpdateType == Reconstruct) {
document()->clearStyleResolver();
} else {
- StyleResolver* styleResolver = document()->styleResolverIfExists();
- ASSERT(styleResolver);
- // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder.
- // Need to change "false" to some valid condition.
- styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
+ StyleResolver* styleResolver = document()->styleResolver();
+ styleResolver->setBuildScopedStyleTreeInDocumentOrder(!scopingNodesForStyleScoped());
if (styleResolverUpdateType == Reset) {
- resetAllRuleSetsInTreeScope(styleResolver);
+ if (DocumentOrderedList* styleScopedScopingNodes = scopingNodesForStyleScoped()) {
+ for (DocumentOrderedList::iterator it = styleScopedScopingNodes->begin(); it != styleScopedScopingNodes->end(); ++it)
+ styleResolver->resetAuthorStyle(toContainerNode(*it));
+ }
+ if (ListHashSet<Node*, 4>* removedNodes = scopingNodesRemoved()) {
+ for (ListHashSet<Node*, 4>::iterator it = removedNodes->begin(); it != removedNodes->end(); ++it)
+ styleResolver->resetAuthorStyle(toContainerNode(*it));
+ }
+ ASSERT(m_treeScope->rootNode() == document());
+ styleResolver->resetAuthorStyle(toContainerNode(m_treeScope->rootNode()));
styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets);
} else {
ASSERT(styleResolverUpdateType == Additive);
@@ -319,7 +292,6 @@ bool StyleSheetCollectionForDocument::updateActiveStyleSheets(DocumentStyleSheet
m_scopingNodesForStyleScoped.didRemoveScopingNodes();
m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
m_styleSheetsForStyleSheetList.swap(styleSheets);
- updateUsesRemUnits();
return requiresFullStyleRecalc;
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h
index ce410343379..91da7850001 100644
--- a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h
+++ b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h
@@ -52,63 +52,47 @@ class StyleSheetList;
class StyleSheetCollection {
WTF_MAKE_NONCOPYABLE(StyleSheetCollection); WTF_MAKE_FAST_ALLOCATED;
public:
+ explicit StyleSheetCollection(TreeScope*);
+
void addStyleSheetCandidateNode(Node*, bool createdByParser);
void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode);
- bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNodes.isEmpty(); }
Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() { return m_activeAuthorStyleSheets; }
Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() { return m_styleSheetsForStyleSheetList; }
const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { return m_activeAuthorStyleSheets; }
const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() const { return m_styleSheetsForStyleSheetList; }
- bool usesRemUnits() const { return m_usesRemUnits; }
-
DocumentOrderedList& styleSheetCandidateNodes() { return m_styleSheetCandidateNodes; }
DocumentOrderedList* scopingNodesForStyleScoped() { return m_scopingNodesForStyleScoped.scopingNodes(); }
ListHashSet<Node*, 4>* scopingNodesRemoved() { return m_scopingNodesForStyleScoped.scopingNodesRemoved(); }
-protected:
- explicit StyleSheetCollection(TreeScope*);
-
- Document* document() { return m_treeScope->documentScope(); }
-
enum StyleResolverUpdateType {
Reconstruct,
Reset,
Additive
};
- void analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc);
- void resetAllRuleSetsInTreeScope(StyleResolver*);
- void updateUsesRemUnits();
+ bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode, StyleResolverUpdateType&);
private:
+ Document* document() { return m_treeScope->documentScope(); }
+
+ void collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
+
StyleResolverUpdateType compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets);
bool activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets);
-protected:
+ void analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc);
+
Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList;
Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets;
TreeScope* m_treeScope;
bool m_hadActiveLoadingStylesheet;
- bool m_usesRemUnits;
DocumentOrderedList m_styleSheetCandidateNodes;
StyleSheetScopingNodeList m_scopingNodesForStyleScoped;
};
-// FIXME: rename this class to DocumentStyleSheetCollection.
-class StyleSheetCollectionForDocument FINAL : public StyleSheetCollection {
- WTF_MAKE_NONCOPYABLE(StyleSheetCollectionForDocument); WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit StyleSheetCollectionForDocument(TreeScope*);
-
- bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode);
-
-private:
- void collectStyleSheets(DocumentStyleSheetCollection*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
-};
-
}
#endif
diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp b/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp
index de321d98914..9bbccdc5711 100644
--- a/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp
@@ -33,6 +33,7 @@
#include "core/html/shadow/HTMLContentElement.h"
#include "core/html/shadow/HTMLShadowElement.h"
+
namespace WebCore {
void ContentDistribution::swap(ContentDistribution& other)
@@ -156,6 +157,8 @@ InsertionPoint* ContentDistributor::findInsertionPointFor(const Node* key) const
void ContentDistributor::populate(Node* node, Vector<Node*>& pool)
{
+ node->lazyReattachIfAttached();
+
if (!isActiveInsertionPoint(node)) {
pool.append(node);
return;
@@ -224,14 +227,6 @@ void ContentDistributor::distribute(Element* host)
if (ElementShadow* shadow = shadowOfParentForDistribution(shadowElement))
shadow->setNeedsDistributionRecalc();
}
-
- // Detach all nodes that were not distributed and have a renderer.
- for (size_t i = 0; i < pool.size(); ++i) {
- if (distributed[i])
- continue;
- if (pool[i]->renderer())
- pool[i]->lazyReattachIfAttached();
- }
}
void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint, const Vector<Node*>& pool, Vector<bool>& distributed)
@@ -251,6 +246,7 @@ void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint,
distributed[i] = true;
}
+ insertionPoint->lazyReattachIfAttached();
insertionPoint->setDistribution(distribution);
}
@@ -258,6 +254,7 @@ void ContentDistributor::distributeNodeChildrenTo(InsertionPoint* insertionPoint
{
ContentDistribution distribution;
for (Node* node = containerNode->firstChild(); node; node = node->nextSibling()) {
+ node->lazyReattachIfAttached();
if (isActiveInsertionPoint(node)) {
InsertionPoint* innerInsertionPoint = toInsertionPoint(node);
if (innerInsertionPoint->hasDistribution()) {
@@ -277,6 +274,7 @@ void ContentDistributor::distributeNodeChildrenTo(InsertionPoint* insertionPoint
}
}
+ insertionPoint->lazyReattachIfAttached();
insertionPoint->setDistribution(distribution);
}
diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
index c00c3c90c01..b4626d77409 100644
--- a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp
@@ -52,48 +52,6 @@ InsertionPoint::~InsertionPoint()
{
}
-void InsertionPoint::setDistribution(ContentDistribution& distribution)
-{
- if (shouldUseFallbackElements()) {
- for (Node* child = firstChild(); child; child = child->nextSibling())
- child->lazyReattachIfAttached();
- }
-
- // Attempt not to reattach nodes that would be distributed to the exact same
- // location by comparing the old and new distributions.
-
- size_t i = 0;
- size_t j = 0;
-
- for ( ; i < m_distribution.size() && j < distribution.size(); ++i, ++j) {
- if (m_distribution.size() < distribution.size()) {
- // If the new distribution is larger than the old one, reattach all nodes in
- // the new distribution that were inserted.
- for ( ; j < distribution.size() && m_distribution.at(i) != distribution.at(j); ++j)
- distribution.at(j)->lazyReattachIfAttached();
- } else if (m_distribution.size() > distribution.size()) {
- // If the old distribution is larger than the new one, reattach all nodes in
- // the old distribution that were removed.
- for ( ; i < m_distribution.size() && m_distribution.at(i) != distribution.at(j); ++i)
- m_distribution.at(i)->lazyReattachIfAttached();
- } else if (m_distribution.at(i) != distribution.at(j)) {
- // If both distributions are the same length reattach both old and new.
- m_distribution.at(i)->lazyReattachIfAttached();
- distribution.at(j)->lazyReattachIfAttached();
- }
- }
-
- // If we hit the end of either list above we need to reattach all remaining nodes.
-
- for ( ; i < m_distribution.size(); ++i)
- m_distribution.at(i)->lazyReattachIfAttached();
-
- for ( ; j < distribution.size(); ++j)
- distribution.at(j)->lazyReattachIfAttached();
-
- m_distribution.swap(distribution);
-}
-
void InsertionPoint::attach(const AttachContext& context)
{
for (size_t i = 0; i < m_distribution.size(); ++i) {
diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h
index b7031292e6f..993ea347969 100644
--- a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h
+++ b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h
@@ -44,7 +44,7 @@ public:
virtual ~InsertionPoint();
bool hasDistribution() const { return !m_distribution.isEmpty(); }
- void setDistribution(ContentDistribution&);
+ void setDistribution(ContentDistribution& distribution) { m_distribution.swap(distribution); }
void clearDistribution() { m_distribution.clear(); }
bool isActive() const;
diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
index 1385db124da..a218b17f3a8 100644
--- a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp
@@ -29,7 +29,6 @@
#include "bindings/v8/ExceptionState.h"
#include "core/css/resolver/StyleResolver.h"
-#include "core/dom/DocumentStyleSheetCollection.h"
#include "core/dom/Text.h"
#include "core/dom/shadow/ContentDistributor.h"
#include "core/dom/shadow/ElementShadow.h"
@@ -77,8 +76,6 @@ ShadowRoot::~ShadowRoot()
ASSERT(!m_prev);
ASSERT(!m_next);
- documentInternal()->styleSheetCollection()->didRemoveShadowRoot(this);
-
// We cannot let ContainerNode destructor call willBeDeletedFrom()
// for this ShadowRoot instance because TreeScope destructor
// clears Node::m_treeScope thus ContainerNode is no longer able
diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h
index 993fdb2efd2..3bfcc3dd49f 100644
--- a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h
+++ b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h
@@ -149,17 +149,6 @@ inline ShadowRoot* toShadowRoot(Node* node)
return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node)));
}
-inline const ShadowRoot* toShadowRoot(const TreeScope* treeScope)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!treeScope || (treeScope->rootNode() && treeScope->rootNode()->isShadowRoot()));
- return static_cast<const ShadowRoot*>(treeScope);
-}
-
-inline ShadowRoot* toShadowRoot(TreeScope* treeScope)
-{
- return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const TreeScope*>(treeScope)));
-}
-
} // namespace
#endif