jenkins-bot has submitted this change and it was merged.

Change subject: Set the same dom-diff flag that WTS checks for!!
......................................................................


Set the same dom-diff flag that WTS checks for!!

* After a 4-hour wild-goose chase confusing myself and looking at
  all the wrong places, I finally found that DOMDiff was setting
  'modified-children' flag and WTS (via DOMUtils) was looking for
  'children-changed' flag (see commit e20fec628).

* This fixes 12 more selser tests (and fixes the unrelated selser
  failures seen in https://gerrit.wikimedia.org/r/#/c/77245/)

Change-Id: I3b5794d03c76215bfac02ab708fd7d64bd87fd19
---
M js/lib/mediawiki.DOMDiff.js
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parserTests-blacklist.js
3 files changed, 7 insertions(+), 20 deletions(-)

Approvals:
  Cscott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/js/lib/mediawiki.DOMDiff.js b/js/lib/mediawiki.DOMDiff.js
index 39a90c4..07755ac 100644
--- a/js/lib/mediawiki.DOMDiff.js
+++ b/js/lib/mediawiki.DOMDiff.js
@@ -246,8 +246,8 @@
                        }
 
                        // Record the fact that direct children changed in the 
parent node
-                       this.debug("--found diff: modified-children--");
-                       this.markNode(newParentNode, 'modified-children');
+                       this.debug("--found diff: children-changed--");
+                       this.markNode(newParentNode, 'children-changed');
 
                        foundDiffOverall = true;
                } else if (!DU.isTplElementNode(this.env, baseNode) && 
!DU.isTplElementNode(this.env, newNode)) {
diff --git a/js/lib/mediawiki.WikitextSerializer.js 
b/js/lib/mediawiki.WikitextSerializer.js
index 1451dbe..c037c01 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -3657,7 +3657,7 @@
                dsrA, dsrB;
 
        if (src && node && prevNode) {
-               if (prevNode && !DU.isElt(prevNode)) {
+               if (!DU.isElt(prevNode)) {
                        // Check if this is the last child of a zero-width 
element, and use
                        // that for dsr purposes instead. Typical case: text in 
p.
                        if (!prevNode.nextSibling &&
@@ -3695,7 +3695,10 @@
                        dsrA = prevNode.data.parsoid.dsr;
                }
 
-               if (node && !DU.isElt(node)) {
+               if (!dsrA) {
+                       /* jshint noempty: false */
+                       // nothing to do -- no reason to compute dsrB if dsrA 
is null
+               } else if (!DU.isElt(node)) {
                        // If this is the child of a zero-width element
                        // and is only preceded by separator elements, we
                        // can use the parent for dsr after correcting the dsr
@@ -3745,10 +3748,6 @@
                        }
                }
 
-               // Do not use '!== null' checks on dsr elts since it appears 
that they can
-               // sometimes be NaN/undefined because of arithmetic done above. 
 This then
-               // leads to the 'dsr backwards' error.
-               //
                // FIXME: Maybe we shouldn't set dsr in the dsr pass if both 
aren't valid?
                if (isValidDSR(dsrA) && isValidDSR(dsrB)) {
                        //console.log(prevNode.data.parsoid.dsr, 
node.data.parsoid.dsr);
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 041b308..8874898 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -2390,15 +2390,8 @@
 add("selser", "Comment semantics: unclosed comment at end [3]");
 add("selser", "Comment semantics: unclosed comment at end [4]");
 add("selser", "Comment semantics: unclosed comment at end [2]");
-add("selser", "Multiple lines without block tags [2,4,0,0,0,[4],0]");
-add("selser", "Multiple lines without block tags [2,0,[2,2,3],4,0,[2],3]");
-add("selser", "Multiple lines without block tags [0,3,[3,3,2],2,0,3,4]");
-add("selser", "Multiple lines without block tags [[2],4,[0,4,2],0,0,3,0]");
 add("selser", "Multiple lines without block tags [0,4,1,0,3,0,4]");
-add("selser", "Multiple lines without block tags [2,0,[4,3,0],0,3,0,0]");
 add("selser", "Multiple lines without block tags [[3],3,1,4,0,0,2]");
-add("selser", "Multiple lines without block tags [2,0,[2,0,0],0,4,3,4]");
-add("selser", "Empty lines between lines with block tags 
[1,0,2,3,3,0,[2],0,0,0,0,4,3,2,[2]]");
 add("selser", "<nowiki> inside <pre> (bug 13238) [4,2,2,0,0]");
 add("selser", "<nowiki> inside <pre> (bug 13238) [0,0,4,0,[[4],0,2,4]]");
 add("selser", "<nowiki> inside <pre> (bug 13238) [3,0,3,3,2]");
@@ -3418,11 +3411,6 @@
 add("selser", "Transclusion of MediaWiki message with space [[3]]");
 add("selser", "Transclusion of MediaWiki message with space [[4]]");
 add("selser", "Transclusion of MediaWiki message with space [[2]]");
-add("selser", "Section extraction, heading surrounded by <noinclude> 
[0,2,3,0,0]");
-add("selser", "Section extraction, heading surrounded by <noinclude> 
[1,2,4,4,0]");
-add("selser", "Section extraction, heading surrounded by <noinclude> 
[0,2,4,0,3]");
-add("selser", "Section extraction, heading surrounded by <noinclude> 
[0,2,2,0,0]");
-add("selser", "Section extraction, heading surrounded by <noinclude> 
[1,2,0,0,0]");
 add("selser", "Section extraction, <pre> around bogus header (bug 10309) 
[0,0,0,4,[3],0,[4],3,0]");
 add("selser", "Section extraction, <pre> around bogus header (bug 10309) 
[2,0,[2],0,[1],0,0,2,2]");
 add("selser", "Section extraction, <pre> around bogus header (bug 10309) 
[2,3,[4],2,1,4,4,0,1]");

-- 
To view, visit https://gerrit.wikimedia.org/r/77836
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b5794d03c76215bfac02ab708fd7d64bd87fd19
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to