Diff
Modified: trunk/LayoutTests/ChangeLog (199870 => 199871)
--- trunk/LayoutTests/ChangeLog 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/ChangeLog 2016-04-22 06:19:41 UTC (rev 199871)
@@ -1,3 +1,20 @@
+2016-04-21 Chris Dumez <[email protected]>
+
+ Drop [UsePointersEvenForNonNullableObjectArguments] from Document
+ https://bugs.webkit.org/show_bug.cgi?id=156881
+
+ Reviewed by Darin Adler.
+
+ Add test cases for cases where the type of the exception being thrown
+ has changed.
+
+ * fast/dom/Document/adoptNode-null-expected.txt: Added.
+ * fast/dom/Document/adoptNode-null.html: Added.
+ * fast/dom/Document/importNode-null-expected.txt: Added.
+ * fast/dom/Document/importNode-null.html: Added.
+ * fast/dom/importNode-null-expected.txt: Removed.
+ * fast/dom/importNode-null.html: Removed.
+
2016-04-21 Dean Jackson <[email protected]>
Backdrop Filter should not be visible if element has visibility:hidden
Added: trunk/LayoutTests/fast/dom/Document/adoptNode-null-expected.txt (0 => 199871)
--- trunk/LayoutTests/fast/dom/Document/adoptNode-null-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/adoptNode-null-expected.txt 2016-04-22 06:19:41 UTC (rev 199871)
@@ -0,0 +1,11 @@
+Tests that document.adoptNode(null) throws a TypeError
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.adoptNode(null) threw exception TypeError: Type error.
+PASS document.adoptNode() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Document/adoptNode-null.html (0 => 199871)
--- trunk/LayoutTests/fast/dom/Document/adoptNode-null.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/adoptNode-null.html 2016-04-22 06:19:41 UTC (rev 199871)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that document.adoptNode(null) throws a TypeError");
+
+shouldThrow("document.adoptNode(null)", "'TypeError: Type error'");
+shouldThrow("document.adoptNode()", "'TypeError: Not enough arguments'");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/Document/importNode-null-expected.txt (0 => 199871)
--- trunk/LayoutTests/fast/dom/Document/importNode-null-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/importNode-null-expected.txt 2016-04-22 06:19:41 UTC (rev 199871)
@@ -0,0 +1,11 @@
+Tests that document.importNode(null) throws a TypeError
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.importNode(null) threw exception TypeError: Type error.
+PASS document.importNode() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Document/importNode-null.html (0 => 199871)
--- trunk/LayoutTests/fast/dom/Document/importNode-null.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/importNode-null.html 2016-04-22 06:19:41 UTC (rev 199871)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that document.importNode(null) throws a TypeError");
+
+shouldThrow("document.importNode(null)", "'TypeError: Type error'");
+shouldThrow("document.importNode()", "'TypeError: Not enough arguments'");
+</script>
+<script src=""
+</body>
+</html>
Deleted: trunk/LayoutTests/fast/dom/importNode-null-expected.txt (199870 => 199871)
--- trunk/LayoutTests/fast/dom/importNode-null-expected.txt 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/fast/dom/importNode-null-expected.txt 2016-04-22 06:19:41 UTC (rev 199871)
@@ -1,4 +0,0 @@
-This page tests calling document.importNode(null). If it passes, you'll see a "PASS" message below.
-
-caught exception: Error: NotSupportedError: DOM Exception 9
-PASS: importNode(null) didn't crash
Deleted: trunk/LayoutTests/fast/dom/importNode-null.html (199870 => 199871)
--- trunk/LayoutTests/fast/dom/importNode-null.html 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/fast/dom/importNode-null.html 2016-04-22 06:19:41 UTC (rev 199871)
@@ -1,35 +0,0 @@
-<html>
-<head>
-<script>
-function print(message, color)
-{
- var paragraph = document.createElement("div");
- paragraph.appendChild(document.createTextNode(message));
- paragraph.style.fontFamily = "monospace";
- if (color)
- paragraph.style.color = color;
- document.getElementById("console").appendChild(paragraph);
-}
-
-function test()
-{
- if (window.testRunner)
- testRunner.dumpAsText();
-
- try {
- document.importNode(null);
- } catch(e) {
- print("caught exception: " + e);
- } finally {
- print("PASS: importNode(null) didn't crash", "green");
- }
-}
-</script>
-</head>
-<body _onload_="test();">
-<p>This page tests calling document.importNode(null). If it passes, you'll
- see a "PASS" message below.</p>
-<hr>
-<div id='console'></div>
-</body>
-</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (199870 => 199871)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-04-22 06:19:41 UTC (rev 199871)
@@ -1,3 +1,15 @@
+2016-04-21 Chris Dumez <[email protected]>
+
+ Drop [UsePointersEvenForNonNullableObjectArguments] from Document
+ https://bugs.webkit.org/show_bug.cgi?id=156881
+
+ Reviewed by Darin Adler.
+
+ Rebaseline now that more checks are passing.
+
+ * web-platform-tests/dom/interfaces-expected.txt:
+ * web-platform-tests/html/dom/interfaces-expected.txt:
+
2016-04-21 Youenn Fablet <[email protected]>
[Fetch API] Improve some fetch response streams tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt (199870 => 199871)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt 2016-04-22 06:19:41 UTC (rev 199871)
@@ -262,8 +262,8 @@
FAIL Document interface: operation createTextNode(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation createComment(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation createProcessingInstruction(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
-FAIL Document interface: operation importNode(Node,boolean) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation adoptNode(Node) assert_equals: property has wrong .length expected 1 but got 0
+PASS Document interface: operation importNode(Node,boolean)
+PASS Document interface: operation adoptNode(Node)
FAIL Document interface: operation createAttribute(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Document interface: operation createAttributeNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL Document interface: operation createEvent(DOMString) assert_equals: property has wrong .length expected 1 but got 0
@@ -331,13 +331,9 @@
fn.apply(obj, args);
}" did not throw
PASS Document interface: xmlDoc must inherit property "importNode" with the proper type (20)
-FAIL Document interface: calling importNode(Node,boolean) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling importNode(Node,boolean) on xmlDoc with too few arguments must throw TypeError
PASS Document interface: xmlDoc must inherit property "adoptNode" with the proper type (21)
-FAIL Document interface: calling adoptNode(Node) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling adoptNode(Node) on xmlDoc with too few arguments must throw TypeError
PASS Document interface: xmlDoc must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on xmlDoc with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (199870 => 199871)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-04-22 06:19:41 UTC (rev 199871)
@@ -167,13 +167,9 @@
fn.apply(obj, args);
}" did not throw
PASS Document interface: iframe.contentDocument must inherit property "importNode" with the proper type (20)
-FAIL Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "adoptNode" with the proper type (21)
-FAIL Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -482,13 +478,9 @@
fn.apply(obj, args);
}" did not throw
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "importNode" with the proper type (20)
-FAIL Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "adoptNode" with the proper type (21)
-FAIL Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (199870 => 199871)
--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-04-22 06:19:41 UTC (rev 199871)
@@ -167,13 +167,9 @@
fn.apply(obj, args);
}" did not throw
PASS Document interface: iframe.contentDocument must inherit property "importNode" with the proper type (20)
-FAIL Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling importNode(Node,boolean) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "adoptNode" with the proper type (21)
-FAIL Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling adoptNode(Node) on iframe.contentDocument with too few arguments must throw TypeError
PASS Document interface: iframe.contentDocument must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
@@ -482,13 +478,9 @@
fn.apply(obj, args);
}" did not throw
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "importNode" with the proper type (20)
-FAIL Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling importNode(Node,boolean) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "adoptNode" with the proper type (21)
-FAIL Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" threw object "Error: NotSupportedError: DOM Exception 9" ("NotSupportedError") expected object "TypeError" ("TypeError")
+PASS Document interface: calling adoptNode(Node) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "createAttribute" with the proper type (22)
FAIL Document interface: calling createAttribute(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
Modified: trunk/Source/WebCore/ChangeLog (199870 => 199871)
--- trunk/Source/WebCore/ChangeLog 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/ChangeLog 2016-04-22 06:19:41 UTC (rev 199871)
@@ -1,3 +1,45 @@
+2016-04-21 Chris Dumez <[email protected]>
+
+ Drop [UsePointersEvenForNonNullableObjectArguments] from Document
+ https://bugs.webkit.org/show_bug.cgi?id=156881
+
+ Reviewed by Darin Adler.
+
+ Drop [UsePointersEvenForNonNullableObjectArguments] from Document. There
+ is no major Web-exposed behavior change but the type of the exception
+ being thrown when passing null or not enough parameters has changed for
+ some of the API (It is now always a TypeError as per the Web IDL
+ specification).
+
+ Tests: fast/dom/Document/adoptNode-null.html
+ fast/dom/Document/importNode-null.html
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::takeAllChildrenFrom):
+ (WebCore::ContainerNode::parserInsertBefore):
+ (WebCore::ContainerNode::parserAppendChild):
+ * dom/Document.cpp:
+ (WebCore::Document::importNode):
+ (WebCore::Document::adoptNode):
+ (WebCore::Document::createNodeIterator):
+ (WebCore::Document::createTreeWalker):
+ (WebCore::Document::setBodyOrFrameset):
+ (WebCore::Document::hasValidNamespaceForElements): Deleted.
+ (WebCore::Document::scheduleForcedStyleRecalc): Deleted.
+ (WebCore::Document::scheduleStyleRecalc): Deleted.
+ (WebCore::Document::unscheduleStyleRecalc): Deleted.
+ (WebCore::Document::hasPendingStyleRecalc): Deleted.
+ (WebCore::Document::hasPendingForcedStyleRecalc): Deleted.
+ (WebCore::Document::recalcStyle): Deleted.
+ (WebCore::Document::explicitClose): Deleted.
+ * dom/Document.h:
+ (WebCore::Document::importNode):
+ * dom/Document.idl:
+ * dom/NodeIterator.cpp:
+ (WebCore::NodeIterator::NodeIterator):
+ * dom/NodeIterator.h:
+ (WebCore::NodeIterator::create):
+
2016-04-21 Frederic Wang <[email protected]>
More improvements and explanations regarding resetting CSS properties on the <math> element
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (199870 => 199871)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2016-04-22 06:19:41 UTC (rev 199871)
@@ -130,7 +130,7 @@
destroyRenderTreeIfNeeded(child);
// FIXME: We need a no mutation event version of adoptNode.
- RefPtr<Node> adoptedChild = document().adoptNode(&child.get(), ASSERT_NO_EXCEPTION);
+ RefPtr<Node> adoptedChild = document().adoptNode(child, ASSERT_NO_EXCEPTION);
parserAppendChild(*adoptedChild);
// FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
// (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
@@ -376,7 +376,7 @@
return;
if (&document() != &newChild->document())
- document().adoptNode(newChild.ptr(), ASSERT_NO_EXCEPTION);
+ document().adoptNode(newChild, ASSERT_NO_EXCEPTION);
insertBeforeCommon(nextChild, newChild);
@@ -718,7 +718,7 @@
#endif
if (&document() != &newChild->document())
- document().adoptNode(newChild.ptr(), ASSERT_NO_EXCEPTION);
+ document().adoptNode(newChild, ASSERT_NO_EXCEPTION);
{
NoEventDispatchAssertion assertNoEventDispatch;
Modified: trunk/Source/WebCore/dom/Document.cpp (199870 => 199871)
--- trunk/Source/WebCore/dom/Document.cpp 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-04-22 06:19:41 UTC (rev 199871)
@@ -992,16 +992,11 @@
return *propertySet->ensureCSSStyleDeclaration();
}
-RefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode& ec)
+RefPtr<Node> Document::importNode(Node& nodeToImport, bool deep, ExceptionCode& ec)
{
- if (!importedNode) {
- ec = NOT_SUPPORTED_ERR;
- return nullptr;
- }
-
- switch (importedNode->nodeType()) {
+ switch (nodeToImport.nodeType()) {
case DOCUMENT_FRAGMENT_NODE:
- if (importedNode->isShadowRoot())
+ if (nodeToImport.isShadowRoot())
break;
FALLTHROUGH;
case ELEMENT_NODE:
@@ -1009,11 +1004,11 @@
case CDATA_SECTION_NODE:
case PROCESSING_INSTRUCTION_NODE:
case COMMENT_NODE:
- return importedNode->cloneNodeInternal(document(), deep ? CloningOperation::Everything : CloningOperation::OnlySelf);
+ return nodeToImport.cloneNodeInternal(document(), deep ? CloningOperation::Everything : CloningOperation::OnlySelf);
case ATTRIBUTE_NODE:
// FIXME: This will "Attr::normalize" child nodes of Attr.
- return Attr::create(*this, QualifiedName(nullAtom, downcast<Attr>(*importedNode).name(), nullAtom), downcast<Attr>(*importedNode).value());
+ return Attr::create(*this, QualifiedName(nullAtom, downcast<Attr>(nodeToImport).name(), nullAtom), downcast<Attr>(nodeToImport).value());
case DOCUMENT_NODE: // Can't import a document into another document.
case DOCUMENT_TYPE_NODE: // FIXME: Support cloning a DocumentType node per DOM4.
@@ -1025,48 +1020,43 @@
}
-RefPtr<Node> Document::adoptNode(Node* source, ExceptionCode& ec)
+RefPtr<Node> Document::adoptNode(Node& source, ExceptionCode& ec)
{
- if (!source) {
- ec = NOT_SUPPORTED_ERR;
- return nullptr;
- }
-
EventQueueScope scope;
- switch (source->nodeType()) {
+ switch (source.nodeType()) {
case DOCUMENT_NODE:
ec = NOT_SUPPORTED_ERR;
return nullptr;
case ATTRIBUTE_NODE: {
- Attr& attr = downcast<Attr>(*source);
+ auto& attr = downcast<Attr>(source);
if (attr.ownerElement())
attr.ownerElement()->removeAttributeNode(&attr, ec);
break;
}
default:
- if (source->isShadowRoot()) {
+ if (source.isShadowRoot()) {
// ShadowRoot cannot disconnect itself from the host node.
ec = HIERARCHY_REQUEST_ERR;
return nullptr;
}
- if (is<HTMLFrameOwnerElement>(*source)) {
- HTMLFrameOwnerElement& frameOwnerElement = downcast<HTMLFrameOwnerElement>(*source);
+ if (is<HTMLFrameOwnerElement>(source)) {
+ auto& frameOwnerElement = downcast<HTMLFrameOwnerElement>(source);
if (frame() && frame()->tree().isDescendantOf(frameOwnerElement.contentFrame())) {
ec = HIERARCHY_REQUEST_ERR;
return nullptr;
}
}
- if (source->parentNode()) {
- source->parentNode()->removeChild(*source, ec);
+ if (source.parentNode()) {
+ source.parentNode()->removeChild(source, ec);
if (ec)
return nullptr;
}
}
- adoptIfNeeded(source);
+ adoptIfNeeded(&source);
- return source;
+ return &source;
}
bool Document::hasValidNamespaceForElements(const QualifiedName& qName)
@@ -1778,54 +1768,16 @@
return Range::create(*this);
}
-RefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&& filter, bool, ExceptionCode& ec)
+Ref<NodeIterator> Document::createNodeIterator(Node& root, unsigned long whatToShow, RefPtr<NodeFilter>&& filter, bool)
{
- return createNodeIterator(root, whatToShow, WTFMove(filter), ec);
-}
-
-RefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&& filter, ExceptionCode& ec)
-{
- if (!root) {
- ec = TypeError;
- return nullptr;
- }
return NodeIterator::create(root, whatToShow, WTFMove(filter));
}
-RefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned long whatToShow, ExceptionCode& ec)
+Ref<TreeWalker> Document::createTreeWalker(Node& root, unsigned long whatToShow, RefPtr<NodeFilter>&& filter, bool)
{
- return createNodeIterator(root, whatToShow, nullptr, ec);
+ return TreeWalker::create(root, whatToShow, WTFMove(filter));
}
-RefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionCode& ec)
-{
- return createNodeIterator(root, 0xFFFFFFFF, nullptr, ec);
-}
-
-RefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&& filter, bool, ExceptionCode& ec)
-{
- return createTreeWalker(root, whatToShow, WTFMove(filter), ec);
-}
-
-RefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&& filter, ExceptionCode& ec)
-{
- if (!root) {
- ec = TypeError;
- return nullptr;
- }
- return TreeWalker::create(*root, whatToShow, WTFMove(filter));
-}
-
-RefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned long whatToShow, ExceptionCode& ec)
-{
- return createTreeWalker(root, whatToShow, nullptr, ec);
-}
-
-RefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionCode& ec)
-{
- return createTreeWalker(root, 0xFFFFFFFF, nullptr, ec);
-}
-
void Document::scheduleForcedStyleRecalc()
{
m_pendingStyleRecalcShouldForce = true;
@@ -2680,7 +2632,7 @@
if (&newBody->document() != this) {
ec = 0;
- RefPtr<Node> node = importNode(newBody.get(), true, ec);
+ RefPtr<Node> node = importNode(*newBody, true, ec);
if (ec)
return;
Modified: trunk/Source/WebCore/dom/Document.h (199870 => 199871)
--- trunk/Source/WebCore/dom/Document.h 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/dom/Document.h 2016-04-22 06:19:41 UTC (rev 199871)
@@ -388,8 +388,8 @@
RefPtr<Attr> createAttribute(const String& name, ExceptionCode&);
RefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
RefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&);
- RefPtr<Node> importNode(Node* importedNode, ExceptionCode& ec) { return importNode(importedNode, false, ec); }
- RefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionCode&);
+ RefPtr<Node> importNode(Node& nodeToImport, ExceptionCode& ec) { return importNode(nodeToImport, false, ec); }
+ RefPtr<Node> importNode(Node& nodeToImport, bool deep, ExceptionCode&);
WEBCORE_EXPORT RefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
WEBCORE_EXPORT Ref<Element> createElement(const QualifiedName&, bool createdByParser);
@@ -458,7 +458,7 @@
void setTimerThrottlingEnabled(bool);
bool isTimerThrottlingEnabled() const { return m_isTimerThrottlingEnabled; }
- RefPtr<Node> adoptNode(Node* source, ExceptionCode&);
+ RefPtr<Node> adoptNode(Node& source, ExceptionCode&);
Ref<HTMLCollection> images();
Ref<HTMLCollection> embeds();
@@ -548,15 +548,11 @@
WEBCORE_EXPORT Ref<Range> createRange();
- RefPtr<NodeIterator> createNodeIterator(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&&, bool, ExceptionCode&); // For ObjC bindings.
- RefPtr<NodeIterator> createNodeIterator(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&&, ExceptionCode&);
- RefPtr<NodeIterator> createNodeIterator(Node* root, unsigned long whatToShow, ExceptionCode&);
- RefPtr<NodeIterator> createNodeIterator(Node* root, ExceptionCode&);
+ // The last bool parameter is for ObjC bindings.
+ Ref<NodeIterator> createNodeIterator(Node& root, unsigned long whatToShow = 0xFFFFFFFF, RefPtr<NodeFilter>&& = nullptr, bool = false);
- RefPtr<TreeWalker> createTreeWalker(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&&, bool, ExceptionCode&); // For ObjC bindings.
- RefPtr<TreeWalker> createTreeWalker(Node* root, unsigned long whatToShow, RefPtr<NodeFilter>&&, ExceptionCode&);
- RefPtr<TreeWalker> createTreeWalker(Node* root, unsigned long whatToShow, ExceptionCode&);
- RefPtr<TreeWalker> createTreeWalker(Node* root, ExceptionCode&);
+ // The last bool parameter is for ObjC bindings.
+ Ref<TreeWalker> createTreeWalker(Node& root, unsigned long whatToShow = 0xFFFFFFFF, RefPtr<NodeFilter>&& = nullptr, bool = false);
// Special support for editing
Ref<CSSStyleDeclaration> createCSSStyleDeclaration();
Modified: trunk/Source/WebCore/dom/Document.idl (199870 => 199871)
--- trunk/Source/WebCore/dom/Document.idl 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/dom/Document.idl 2016-04-22 06:19:41 UTC (rev 199871)
@@ -22,16 +22,15 @@
Constructor,
ConstructorCallWith=ScriptExecutionContext,
CustomToJSObject,
- UsePointersEvenForNonNullableObjectArguments,
JSCustomHeader,
JSGenerateToNativeObject,
ExportMacro=WEBCORE_EXPORT,
] interface Document : Node {
// DOM Level 1 Core
- readonly attribute DocumentType doctype;
+ readonly attribute DocumentType? doctype;
readonly attribute DOMImplementation implementation;
- readonly attribute Element documentElement;
+ readonly attribute Element? documentElement;
[NewObject, RaisesException, ImplementedAs=createElementForBindings] Element createElement(DOMString tagName);
[NewObject] DocumentFragment createDocumentFragment();
@@ -54,8 +53,7 @@
// Introduced in DOM Level 2:
- [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
- optional boolean deep);
+ [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode(Node importedNode, optional boolean deep);
// FIXME: 'qualifiedName' should not have [TreatNullAs=EmptyString].
[ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS([Default=Undefined] optional DOMString? namespaceURI,
@@ -79,7 +77,7 @@
[SetterRaisesException] attribute DOMString? xmlVersion;
[SetterRaisesException] attribute boolean xmlStandalone;
- [RaisesException] Node adoptNode([Default=Undefined] optional Node source);
+ [RaisesException] Node adoptNode(Node source);
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT
// document.documentURI was writable in DOM3 Core, but is read-only in DOM4
@@ -102,19 +100,19 @@
// DOM Level 2 Tranversal and Range (DocumentTraversal interface)
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT
- [ObjCLegacyUnnamedParameters, RaisesException] NodeIterator createNodeIterator(Node root,
+ [ObjCLegacyUnnamedParameters] NodeIterator createNodeIterator(Node root,
optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter,
optional boolean expandEntityReferences);
- [ObjCLegacyUnnamedParameters, RaisesException] TreeWalker createTreeWalker(Node root,
+ [ObjCLegacyUnnamedParameters] TreeWalker createTreeWalker(Node root,
optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter,
optional boolean expandEntityReferences);
#else
- [RaisesException, NewObject] NodeIterator createNodeIterator(Node root,
+ [NewObject] NodeIterator createNodeIterator(Node root,
optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter);
- [RaisesException, NewObject] TreeWalker createTreeWalker(Node root,
+ [NewObject] TreeWalker createTreeWalker(Node root,
optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter);
#endif
@@ -129,20 +127,20 @@
// DOM Level 2 Style (DocumentCSS interface)
- [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
+ [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element? element,
[Default=Undefined] optional DOMString pseudoElement);
readonly attribute DOMString contentType;
// DOM Level 3 XPath (XPathEvaluator interface)
[ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString _expression_,
- [Default=Undefined] optional XPathNSResolver resolver);
- XPathNSResolver createNSResolver(Node nodeResolver);
+ [Default=Undefined] optional XPathNSResolver? resolver);
+ XPathNSResolver createNSResolver(Node? nodeResolver);
[ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString _expression_,
- [Default=Undefined] optional Node contextNode,
- [Default=Undefined] optional XPathNSResolver resolver,
+ [Default=Undefined] optional Node? contextNode,
+ [Default=Undefined] optional XPathNSResolver? resolver,
[Default=Undefined] optional unsigned short type,
- [Default=Undefined] optional XPathResult inResult);
+ [Default=Undefined] optional XPathResult? inResult);
// Common extensions
boolean execCommand([Default=Undefined] optional DOMString command,
@@ -179,9 +177,9 @@
// FIXME: Should not have [TreatNullAs=EmptyString].
[TreatNullAs=EmptyString, GetterRaisesException, SetterRaisesException] attribute DOMString cookie;
- [SetterRaisesException, ImplementedAs=bodyOrFrameset, StrictTypeChecking] attribute HTMLElement body;
+ [SetterRaisesException, ImplementedAs=bodyOrFrameset, StrictTypeChecking] attribute HTMLElement? body;
- readonly attribute HTMLHeadElement head;
+ readonly attribute HTMLHeadElement? head;
readonly attribute HTMLCollection images;
readonly attribute HTMLCollection applets;
readonly attribute HTMLCollection links;
@@ -227,14 +225,14 @@
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
// DOM Level 2 Style Interface
- [ObjCLegacyUnnamedParameters, ObjCUseDefaultView] CSSStyleDeclaration getComputedStyle(Element element,
+ [ObjCLegacyUnnamedParameters, ObjCUseDefaultView] CSSStyleDeclaration getComputedStyle(Element? element,
DOMString pseudoElement);
// WebKit extension
// FIXME: remove the first version once optional is implemented for Objective-C.
- [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(Element element,
+ [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(Element? element,
DOMString pseudoElement);
- [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(Element element,
+ [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(Element? element,
DOMString pseudoElement,
optional boolean authorOnly);
@@ -251,7 +249,7 @@
HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString classNames);
#endif
- readonly attribute Element activeElement;
+ readonly attribute Element? activeElement;
boolean hasFocus();
readonly attribute DOMString compatMode;
@@ -265,12 +263,12 @@
// W3C version
readonly attribute boolean webkitFullscreenEnabled;
- readonly attribute Element webkitFullscreenElement;
+ readonly attribute Element? webkitFullscreenElement;
void webkitExitFullscreen();
#endif
[Conditional=POINTER_LOCK] void exitPointerLock();
- [Conditional=POINTER_LOCK] readonly attribute Element pointerLockElement;
+ [Conditional=POINTER_LOCK] readonly attribute Element? pointerLockElement;
[Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows();
@@ -281,8 +279,8 @@
#if defined(ENABLE_IOS_TOUCH_EVENTS) && ENABLE_IOS_TOUCH_EVENTS
#include <WebKitAdditions/DocumentIOS.idl>
#elif defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
- [NewObject, RaisesException] Touch createTouch([Default=Undefined] optional DOMWindow window,
- [Default=Undefined] optional EventTarget target,
+ [NewObject, RaisesException] Touch createTouch([Default=Undefined] optional DOMWindow? window,
+ [Default=Undefined] optional EventTarget? target,
[Default=Undefined] optional long identifier,
[Default=Undefined] optional long pageX,
[Default=Undefined] optional long pageY,
@@ -305,13 +303,13 @@
readonly attribute boolean hidden;
// currentscript API: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript
- readonly attribute HTMLScriptElement currentScript;
+ readonly attribute HTMLScriptElement? currentScript;
// http://www.w3.org/TR/2014/WD-dom-20140204/#dom-document-origin
readonly attribute DOMString origin;
// http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement
- readonly attribute Element scrollingElement;
+ readonly attribute Element? scrollingElement;
// Event Handlers
Modified: trunk/Source/WebCore/dom/NodeIterator.cpp (199870 => 199871)
--- trunk/Source/WebCore/dom/NodeIterator.cpp 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/dom/NodeIterator.cpp 2016-04-22 06:19:41 UTC (rev 199871)
@@ -76,8 +76,8 @@
return node;
}
-NodeIterator::NodeIterator(Node* rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
- : NodeIteratorBase(*rootNode, whatToShow, WTFMove(filter))
+NodeIterator::NodeIterator(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
+ : NodeIteratorBase(rootNode, whatToShow, WTFMove(filter))
, m_referenceNode(root(), true)
{
root()->document().attachNodeIterator(this);
Modified: trunk/Source/WebCore/dom/NodeIterator.h (199870 => 199871)
--- trunk/Source/WebCore/dom/NodeIterator.h 2016-04-22 06:07:32 UTC (rev 199870)
+++ trunk/Source/WebCore/dom/NodeIterator.h 2016-04-22 06:19:41 UTC (rev 199871)
@@ -36,7 +36,7 @@
class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public NodeIteratorBase {
public:
- static Ref<NodeIterator> create(Node* rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
+ static Ref<NodeIterator> create(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
{
return adoptRef(*new NodeIterator(rootNode, whatToShow, WTFMove(filter)));
}
@@ -53,7 +53,7 @@
void nodeWillBeRemoved(Node&);
private:
- NodeIterator(Node*, unsigned long whatToShow, RefPtr<NodeFilter>&&);
+ NodeIterator(Node&, unsigned long whatToShow, RefPtr<NodeFilter>&&);
struct NodePointer {
RefPtr<Node> node;