[Webkit-unassigned] [Bug 263302] [iOS] range.toString() ignores newlines
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Oct 17 23:56:43 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=263302
--- Comment #1 from Morgan Redding <morganfredding at gmail.com> ---
Probably something like this should work (I cannot seem to run the tests on my machine):
1) add `#include "../editing/TextIterator.h"` to "Source/WebCore/dom/Range.cpp"
2) change "Range::toString() const" to
```
String Range::toString() const
{
auto range = makeSimpleRange(*this);
return plainText(range, options);
}
```
For your convenience, here is the output of `git diff`:
```
diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp
index 5ea2924c3ad3..890888b9022b 100644
--- a/Source/WebCore/dom/Range.cpp
+++ b/Source/WebCore/dom/Range.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "Range.h"
+#include "../editing/TextIterator.h"
#include "Comment.h"
#include "CustomElementReactionQueue.h"
#include "DOMRect.h"
@@ -720,14 +721,7 @@ ExceptionOr<void> Range::insertNode(Ref<Node>&& node)
String Range::toString() const
{
auto range = makeSimpleRange(*this);
- StringBuilder builder;
- for (auto& node : intersectingNodes(range)) {
- if (is<Text>(node)) {
- auto offsetRange = characterDataOffsetRange(range, node);
- builder.appendSubstring(downcast<Text>(node).data(), offsetRange.start, offsetRange.end - offsetRange.start);
- }
- }
- return builder.toString();
+ return plainText(range, options);
}
```
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231018/21449b5f/attachment.htm>
More information about the webkit-unassigned
mailing list