[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:41:43 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 231428aaa7295d4aacebe43a2ebdce79abb4dc93
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue May 25 21:00:02 2004 +0000
Reviewed by John.
- fixed <rdar://problem/3657363>: (Editing: export innerText, innerHTML, outerText, outerHTML and setters to Objective-C)
- partial fix for <rdar://problem/3656706>: (Fix innerText and setInnerText DOM extensions)
* khtml/html/html_elementimpl.cpp:
(HTMLElementImpl::innerText): Use plainText() to make the text, to
match other browsers.
(HTMLElementImpl::outerText): Extended comment.
* khtml/misc/khtml_text_operations.h:
* kwq/DOMExtensions.h:
* kwq/DOMHTML.mm:
(-[DOMHTMLElement outerText]): Added new ObjC wrapper for this.
(-[DOMHTMLElement setOuterText:]): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 4935d6c..cb3d978 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2004-05-25 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by John.
+
+ - fixed <rdar://problem/3657363>: (Editing: export innerText, innerHTML, outerText, outerHTML and setters to Objective-C)
+ - partial fix for <rdar://problem/3656706>: (Fix innerText and setInnerText DOM extensions)
+
+ * khtml/html/html_elementimpl.cpp:
+ (HTMLElementImpl::innerText): Use plainText() to make the text, to
+ match other browsers.
+ (HTMLElementImpl::outerText): Extended comment.
+ * khtml/misc/khtml_text_operations.h:
+ * kwq/DOMExtensions.h:
+ * kwq/DOMHTML.mm:
+ (-[DOMHTMLElement outerText]): Added new ObjC wrapper for this.
+ (-[DOMHTMLElement setOuterText:]): Ditto.
+
2004-05-25 Ken Kocienda <kocienda at apple.com>
Reviewed by Chris
diff --git a/WebCore/khtml/editing/visible_text.h b/WebCore/khtml/editing/visible_text.h
index 3e8a705..23065b0 100644
--- a/WebCore/khtml/editing/visible_text.h
+++ b/WebCore/khtml/editing/visible_text.h
@@ -23,8 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __khtml_text_iterator_h__
-#define __khtml_text_iterator_h__
+#ifndef __khtml_text_operations_h__
+#define __khtml_text_operations_h__
#include <dom/dom2_range.h>
diff --git a/WebCore/khtml/html/html_elementimpl.cpp b/WebCore/khtml/html/html_elementimpl.cpp
index 8fc0f71..39ae00a 100644
--- a/WebCore/khtml/html/html_elementimpl.cpp
+++ b/WebCore/khtml/html/html_elementimpl.cpp
@@ -34,6 +34,7 @@
#include "html/htmltokenizer.h"
#include "misc/htmlhashes.h"
+#include "misc/khtml_text_operations.h"
#include "khtmlview.h"
#include "khtml_part.h"
@@ -646,36 +647,28 @@ DOMString HTMLElementImpl::outerHTML() const
DOMString HTMLElementImpl::innerText() const
{
- DOMString text;
+ Node startContainer(const_cast<HTMLElementImpl *>(this));
+ long startOffset = 0;
+ Node endContainer(const_cast<HTMLElementImpl *>(this));
- const NodeImpl *n = firstChild();
- // find the next text/image after the anchor, to get a position
- while(n) {
- if(n->isTextNode() ) {
- text += static_cast<const TextImpl *>(n)->data();
- }
- if(n->firstChild())
- n = n->firstChild();
- else if(n->nextSibling())
- n = n->nextSibling();
- else {
- NodeImpl *next = 0;
- while(!next) {
- n = n->parentNode();
- if(!n || n == (NodeImpl *)this ) goto end;
- next = n->nextSibling();
- }
- n = next;
- }
+ long endOffset = 0;
+
+ for (NodeImpl *child = firstChild(); child; child = child->nextSibling()) {
+ endOffset++;
}
- end:
- return text;
+
+ Range innerRange(startContainer, startOffset, endContainer, endOffset);
+
+ return plainText(innerRange);
}
DOMString HTMLElementImpl::outerText() const
{
- // getting outerText is the same as getting innerText, only
- // setting is different.
+ // Getting outerText is the same as getting innerText, only
+ // setting is different. You would think this should get the plain
+ // text for the outer range, but this is wrong, <br> for instance
+ // would return different values for inner and outer text by such
+ // a rule, but it doesn't.
return innerText();
}
diff --git a/WebCore/khtml/misc/khtml_text_operations.h b/WebCore/khtml/misc/khtml_text_operations.h
index 3e8a705..23065b0 100644
--- a/WebCore/khtml/misc/khtml_text_operations.h
+++ b/WebCore/khtml/misc/khtml_text_operations.h
@@ -23,8 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __khtml_text_iterator_h__
-#define __khtml_text_iterator_h__
+#ifndef __khtml_text_operations_h__
+#define __khtml_text_operations_h__
#include <dom/dom2_range.h>
diff --git a/WebCore/kwq/DOMExtensions.h b/WebCore/kwq/DOMExtensions.h
index aa17b91..ef6049f 100644
--- a/WebCore/kwq/DOMExtensions.h
+++ b/WebCore/kwq/DOMExtensions.h
@@ -39,6 +39,8 @@
- (void)setInnerText:(NSString *)innerText;
- (NSString *)outerHTML;
- (void)setOuterHTML:(NSString *)outerHTML;
+- (NSString *)outerText;
+- (void)setOuterText:(NSString *)outerText;
- (DOMHTMLCollection *)children;
- (NSString *)contentEditable;
- (void)setContentEditable:(NSString *)contentEditable;
diff --git a/WebCore/kwq/DOMHTML.mm b/WebCore/kwq/DOMHTML.mm
index 7869f42..b8049d9 100644
--- a/WebCore/kwq/DOMHTML.mm
+++ b/WebCore/kwq/DOMHTML.mm
@@ -370,6 +370,17 @@ using DOM::NodeImpl;
[self _HTMLElementImpl]->setInnerText(innerText);
}
+
+- (NSString *)outerText
+{
+ return [self _HTMLElementImpl]->outerText();
+}
+
+- (void)setOuterText:(NSString *)outerText
+{
+ [self _HTMLElementImpl]->setOuterText(outerText);
+}
+
- (DOMHTMLCollection *)children
{
HTMLCollectionImpl *collection = new HTMLCollectionImpl([self _HTMLElementImpl], HTMLCollectionImpl::NODE_CHILDREN);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list