mediawiki-extensions-Discus.../includes
Bartosz Dziewoński c1f4668806 Change CommentParser and ImmutableRange to use offsets in codepoints instead of bytes
The PHP DOM extension measures lengths and offsets in Unicode codepoints.
Our PHP code used UTF-8 bytes, causing some offsets to be slightly off.
Now it mostly uses Unicode codepoints as well (we're forced to use bytes
in a few places, because preg_match returns offsets in bytes).

In practice, this had no visible effect to the user. It caused the
markers `<span data-mw-comment-end="..."></span>` to be placed at
the end of their container instead of the correct position when the
timestamp contained multibyte characters (e.g. "ź" in Polish); but
the correct position is usually at the end of the container anyway.

In the test cases, the only difference is placing these markers before
a trailing line break inside `<p>...</p>` tags rather than before it.

The patch also accidentally fixes another bug, where element nodes
with no children (mostly <img>) were incorrectly excluded when calling
cloneContents(), because they were treated as if they were text nodes.

Change-Id: Iccdccf1078598f4b62cab96225e9c85a4c0e93ee
2021-09-27 19:04:16 +00:00
..
Actions Injected SubscriptionStore into UnsubscribeAction 2021-08-09 22:38:52 +00:00
Hooks Replace usage of deprecated PageProps::getInstance() 2021-09-26 00:48:51 +00:00
Notifications Merge "Enhance Echo user talk edit and mention notifications" 2021-09-24 02:17:57 +00:00
ApiDiscussionTools.php build: Updating composer dependencies 2021-09-08 23:14:53 +00:00
ApiDiscussionToolsEdit.php build: Updating composer dependencies 2021-09-08 23:14:53 +00:00
ApiDiscussionToolsGetSubscriptions.php Add API to get the status of topic subscriptions on a page 2021-09-07 21:38:09 +00:00
ApiDiscussionToolsSubscribe.php build: Updating composer dependencies 2021-09-08 23:14:53 +00:00
CommentFormatter.php Deduplicate logic for subscribable headings 2021-09-07 21:38:35 +00:00
CommentItem.php Deduplicate logic for subscribable headings 2021-09-07 21:38:35 +00:00
CommentModifier.php Remove use of DOMXPath to remove Phan suppressions 2021-08-02 18:23:16 +02:00
CommentParser.php Change CommentParser and ImmutableRange to use offsets in codepoints instead of bytes 2021-09-27 19:04:16 +00:00
CommentUtils.php Change CommentParser and ImmutableRange to use offsets in codepoints instead of bytes 2021-09-27 19:04:16 +00:00
Data.php Merge "Recognize links to add a new topic that use Special:NewSection" 2021-08-02 17:42:30 +00:00
HeadingItem.php Deduplicate logic for subscribable headings 2021-09-07 21:38:35 +00:00
ImmutableRange.php Change CommentParser and ImmutableRange to use offsets in codepoints instead of bytes 2021-09-27 19:04:16 +00:00
NodeFilter.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
ServiceWiring.php build: Updating dependencies 2021-07-22 16:29:04 +00:00
SubscriptionItem.php Add API to get the status of topic subscriptions on a page 2021-09-07 21:38:09 +00:00
SubscriptionStore.php Remove unused 'use' definitions 2021-08-31 22:03:51 +02:00
ThreadItem.php build: Updating composer dependencies 2021-09-08 23:14:53 +00:00
TreeWalker.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00