[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
ap at apple.com
ap at apple.com
Wed Apr 7 23:18:27 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 84ab1196b3dc79afb05070129068cf919a830e48
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 2 18:41:55 2009 +0000
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=30969
A no-prefix XPath node test should not match no-namespace elements in HTML document
Test: fast/xpath/null-namespace-in-html.html
* xml/XPathStep.cpp: (WebCore::XPath::nodeMatchesBasicTest): Special case non-HTML elements
in HTML documents (as these are the ones that can have null namespace).
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50419 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a38ae81..2c40a53 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-30 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30969
+ A no-prefix XPath node test should not match no-namespace elements in HTML document
+
+ * fast/xpath/null-namespace-in-html-expected.txt: Added.
+ * fast/xpath/null-namespace-in-html.html: Added.
+
2009-11-02 Keishi Hattori <casey.hattori at gmail.com>
Reviewed by Timothy Hatcher.
diff --git a/LayoutTests/fast/xpath/null-namespace-in-html-expected.txt b/LayoutTests/fast/xpath/null-namespace-in-html-expected.txt
new file mode 100644
index 0000000..53627ee
--- /dev/null
+++ b/LayoutTests/fast/xpath/null-namespace-in-html-expected.txt
@@ -0,0 +1,7 @@
+This tests that XPath expressions with prefixes work correctly.
+
+PASS //div
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/xpath/null-namespace-in-html.html b/LayoutTests/fast/xpath/null-namespace-in-html.html
new file mode 100644
index 0000000..5fee53a
--- /dev/null
+++ b/LayoutTests/fast/xpath/null-namespace-in-html.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<script src="xpath-test-pre.js"></script>
+</head>
+<body>
+<p>This tests that XPath expressions with prefixes work correctly.</p>
+<div id="console"></div>
+<script>
+ var xmlString = '<div/>';
+ var doc = (new DOMParser()).parseFromString(xmlString, "text/xml");
+ document.body.insertBefore(document.importNode(doc.documentElement, null), document.body.firstChild);
+
+ var expr = document.createExpression("//div", null);
+ var result = expr.evaluate(document.documentElement, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ checkSnapshot("//div", result, [document.getElementById("console")]);
+
+ var successfullyParsed = true;
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b82610d..fdfd6be 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-30 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30969
+ A no-prefix XPath node test should not match no-namespace elements in HTML document
+
+ Test: fast/xpath/null-namespace-in-html.html
+
+ * xml/XPathStep.cpp: (WebCore::XPath::nodeMatchesBasicTest): Special case non-HTML elements
+ in HTML documents (as these are the ones that can have null namespace).
+
2009-11-02 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Timothy Hatcher.
diff --git a/WebCore/xml/XPathStep.cpp b/WebCore/xml/XPathStep.cpp
index 411b616..e5f2048 100644
--- a/WebCore/xml/XPathStep.cpp
+++ b/WebCore/xml/XPathStep.cpp
@@ -193,9 +193,13 @@ static inline bool nodeMatchesBasicTest(Node* node, Step::Axis axis, const Step:
if (name == starAtom)
return namespaceURI.isEmpty() || namespaceURI == node->namespaceURI();
- if (node->isHTMLElement() && node->document()->isHTMLDocument()) {
- // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively.
- return equalIgnoringCase(static_cast<Element*>(node)->localName(), name) && (namespaceURI.isNull() || namespaceURI == node->namespaceURI());
+ if (node->document()->isHTMLDocument()) {
+ if (node->isHTMLElement()) {
+ // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively.
+ return equalIgnoringCase(static_cast<Element*>(node)->localName(), name) && (namespaceURI.isNull() || namespaceURI == node->namespaceURI());
+ }
+ // An expression without any prefix shouldn't match no-namespace nodes (because HTML5 says so).
+ return static_cast<Element*>(node)->hasLocalName(name) && namespaceURI == node->namespaceURI() && !namespaceURI.isNull();
}
return static_cast<Element*>(node)->hasLocalName(name) && namespaceURI == node->namespaceURI();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list