Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/159219

Change subject: DSR computation fix for fostered nodes
......................................................................

DSR computation fix for fostered nodes

* Fixed DSR computation code to ensure that DSR on fostered content
  is always valid (this bug got triggered in some scenarios with
  changes to p-wrapping and led to content duplication in selser
  mode).

  Extracted from the p-wrapping patch.

Change-Id: Ie92944ab10983c9ceee07257d131c11fcd849d6b
---
M lib/dom.computeDSR.js
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/19/159219/1

diff --git a/lib/dom.computeDSR.js b/lib/dom.computeDSR.js
index 0088e92..4af3e28 100644
--- a/lib/dom.computeDSR.js
+++ b/lib/dom.computeDSR.js
@@ -454,7 +454,16 @@
                                }
 
                                // Fostered nodes get a zero-dsr width range.
-                               dp.dsr = fosteredNode ? [origCE, origCE] : [cs, 
ce, stWidth, etWidth];
+                               if (fosteredNode) {
+                                       // Reset to 0, if necessary.
+                                       // This is critical to avoid 
duplication of fostered content in selser mode.
+                                       if (origCE < 0) {
+                                               origCE = 0;
+                                       }
+                                       dp.dsr = [origCE, origCE];
+                               } else {
+                                       dp.dsr = [cs, ce, stWidth, etWidth];
+                               }
                                env.log("trace/dsr", function() {
                                        var str = "     UPDATING " + 
child.nodeName +
                                                " with [" + cs + "," + ce + "]; 
typeof: " +cTypeOf;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie92944ab10983c9ceee07257d131c11fcd849d6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to