WebKit Bugzilla
Attachment 17294 Details for
Bug 15988
: REGRESSION: XPath preceding-axis query misses nested elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed fix
15988r1_patch.txt (text/plain), 5.37 KB, created by
Alexey Proskuryakov
on 2007-11-15 08:43:03 PST
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Alexey Proskuryakov
Created:
2007-11-15 08:43:03 PST
Size:
5.37 KB
patch
obsolete
>Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 27811) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2007-11-15 Alexey Proskuryakov <ap@webkit.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ http://bugs.webkit.org/show_bug.cgi?id=15988 >+ REGRESSION: XPath preceding-axis query misses nested elements >+ >+ Test: fast/xpath/preceding-axis.xhtml >+ >+ * xml/XPathStep.cpp: >+ (WebCore::XPath::Step::nodesInAxis): Hopefully correct this time. >+ > 2007-11-14 Brady Eidson <beidson@apple.com> > > Rubberstamped by Sam >Index: WebCore/xml/XPathStep.cpp >=================================================================== >--- WebCore/xml/XPathStep.cpp (revision 27807) >+++ WebCore/xml/XPathStep.cpp (working copy) >@@ -169,14 +169,12 @@ void Step::nodesInAxis(Node* context, No > if (context->isAttributeNode()) > context = static_cast<Attr*>(context)->ownerElement(); > >- for (Node* p = context; !isRootDomNode(p); p = p->parentNode()) { >- for (Node* n = p->previousSibling(); n ; n = n->previousSibling()) { >- for (Node* c = n->lastChild(); c && c != n; c = c->traversePreviousNode(n)) >- if (nodeMatches(c)) >- nodes.append(c); >+ Node* n = context; >+ while (Node* parent = n->parent()) { >+ for (n = n->traversePreviousNode(); n != parent; n = n->traversePreviousNode()) > if (nodeMatches(n)) > nodes.append(n); >- } >+ n = parent; > } > nodes.markSorted(false); > return; >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 27811) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2007-11-15 Khoo Yit Phang <khooyp@cs.umd.edu> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ http://bugs.webkit.org/show_bug.cgi?id=15988 >+ REGRESSION: XPath preceding-axis query misses nested elements >+ >+ * fast/xpath/preceding-axis-expected.txt: Added. >+ * fast/xpath/preceding-axis.xhtml: Added. >+ > 2007-11-14 Alexey Proskuryakov <ap@webkit.org> > > Reviewed by Justin Garcia. >Index: LayoutTests/fast/xpath/preceding-axis-expected.txt >=================================================================== >--- LayoutTests/fast/xpath/preceding-axis-expected.txt (revision 0) >+++ LayoutTests/fast/xpath/preceding-axis-expected.txt (revision 0) >@@ -0,0 +1,18 @@ >+ Querying in the following... >+ >+<div xmlns="http://www.w3.org/1999/xhtml" id="test"> >+ <span id="A"></span> >+ <div> >+ <span id="B"> >+ <span id="C"></span> >+ </span> >+ </div> >+ <span id="D"></span> >+</div> >+ >+Query "preceding::xhtml:span" from span#D >+Result: span#A span#B span#C >+Expected: span#A span#B span#C >+***SUCCESS*** >+ >+ > >Property changes on: LayoutTests/fast/xpath/preceding-axis-expected.txt >___________________________________________________________________ >Name: svn:mime-type > + text/plain >Name: svn:eol-style > + native > >Index: LayoutTests/fast/xpath/preceding-axis.xhtml >=================================================================== >--- LayoutTests/fast/xpath/preceding-axis.xhtml (revision 0) >+++ LayoutTests/fast/xpath/preceding-axis.xhtml (revision 0) >@@ -0,0 +1,57 @@ >+<?xml version="1.0" encoding="utf-8"?> >+<!DOCTYPE html> >+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> >+<head> >+<title>XPath preceding axis misses nested elements</title> >+<style>div#msg { white-space: pre; }</style> >+<script> >+if (window.layoutTestController) >+ layoutTestController.dumpAsText(); >+ >+window.addEventListener("load", function() { >+ var msg = document.getElementById("msg"); >+ function print(s) { msg.textContent += s; } >+ function id(el) { return el.tagName + (el.id ? "#" + el.id : ""); } >+ function query(el, xpath, expected) { >+ print("Query \"" + xpath + "\" from " + id(el) + "\n"); >+ var res = document.evaluate(xpath, >+ el, >+ function() { return "http://www.w3.org/1999/xhtml"; }, >+ XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, >+ null); >+ >+ var resstr = ""; >+ for (var i = 0; i < res.snapshotLength; i++) { >+ var el = res.snapshotItem(i); >+ resstr += " " + id(el); >+ } >+ print("Result:" + resstr + "\n"); >+ print("Expected: " + expected + "\n"); >+ if (resstr != (" " + expected)) { >+ print("***FAIL***\n"); >+ } else { >+ print("***SUCCESS***\n"); >+ } >+ print("\n"); >+ } >+ >+ print("Querying in the following...\n\n"); >+ print(document.getElementById("test").outerHTML + "\n\n"); >+ >+ query(document.getElementById("D"), "preceding::xhtml:span", "span#A span#B span#C"); >+}, false); >+</script> >+</head> >+<body> >+<div id="test"> >+ <span id="A"/> >+ <div> >+ <span id="B"> >+ <span id="C"/> >+ </span> >+ </div> >+ <span id="D"/> >+</div> >+<div id="msg"/> >+</body> >+</html> >\ No newline at end of file > >Property changes on: LayoutTests/fast/xpath/preceding-axis.xhtml >___________________________________________________________________ >Name: svn:mime-type > + text/xml >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 15988
:
17274
|
17275
| 17294