[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:42:20 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8aea1e2ee67b1bff0386e5abafc7c9394641c32c
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu May 27 16:18:26 2004 +0000
Reviewed by Gramps
Add helper to get the DOM element for a Position.
* khtml/xml/dom_position.cpp:
(DOM::Position::element): Returns the Position's node if it is an element, or
the first ancestor of the node that is an element. Returns 0 if node is not
an element and has no parent that is an element.
* khtml/xml/dom_position.h: Added declaration.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8efb74d..8efe932 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,15 @@
+2004-05-27 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Gramps
+
+ Add helper to get the DOM element for a Position.
+
+ * khtml/xml/dom_position.cpp:
+ (DOM::Position::element): Returns the Position's node if it is an element, or
+ the first ancestor of the node that is an element. Returns 0 if node is not
+ an element and has no parent that is an element.
+ * khtml/xml/dom_position.h: Added declaration.
+
2004-05-27 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/khtml/xml/dom_position.cpp b/WebCore/khtml/xml/dom_position.cpp
index 5228d63..1d3b49b 100644
--- a/WebCore/khtml/xml/dom_position.cpp
+++ b/WebCore/khtml/xml/dom_position.cpp
@@ -34,6 +34,7 @@
#include "rendering/render_style.h"
#include "rendering/render_text.h"
#include "xml/dom_edititerator.h"
+#include "xml/dom_elementimpl.h"
#include "xml/dom_nodeimpl.h"
#if APPLE_CHANGES
@@ -134,6 +135,17 @@ Position &Position::operator=(const Position &o)
return *this;
}
+ElementImpl *Position::element() const
+{
+ if (isEmpty())
+ return 0;
+
+ NodeImpl *n = node();
+ for (; n && !n->isElementNode(); n = n->parentNode()); //loop
+
+ return static_cast<ElementImpl *>(n);
+}
+
long Position::renderedOffset() const
{
if (!node()->isTextNode())
diff --git a/WebCore/khtml/xml/dom_position.h b/WebCore/khtml/xml/dom_position.h
index 91755cd..6b8c64a 100644
--- a/WebCore/khtml/xml/dom_position.h
+++ b/WebCore/khtml/xml/dom_position.h
@@ -28,6 +28,7 @@
namespace DOM {
+class ElementImpl;
class NodeImpl;
class Position
@@ -41,6 +42,8 @@ public:
NodeImpl *node() const { return m_node; }
long offset() const { return m_offset; }
+ ElementImpl *element() const;
+
long renderedOffset() const;
bool isEmpty() const { return m_node == 0; }
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list