Record length of trimmed whitespace in additional DSR fields


Record length of trimmed whitespace in additional DSR fields

  • As part of T157418, Parsoid trims leading and trailing whitespace in list items, headings, and table cells. When we did that, we silently discarded the whitespace since we didn't need that information for selective serialization. However, this situation has changed as part of T262408.
  • Expand the DSR array by 2 more elements to track any trimmed leading / trailing WS in elements.
  • There are some gotchas here when whitespace trimming skips over intermediate rendering-transparent nodes (comments, cat-links, etc.). We use -1 in the DSR array to flag these cases for now. T264921 will eventually clean up this behavior.
  • This information will be used by followup patches to aid with more precise selective serialization of deeply nested lists.

    Without the additional DSR fields from this patch, attempts to use the more precise selser technique will actually lead to lost content in some scenarios.

    To enable us to safely use that technique, we bump the version string in this patch to 2.1.1. This is a minor update that most clients shouldn't care about.
  • In followup patches buildSep will use this information to recover trimmed whitespace in scenarios where full selser of the parent node was not possible.
  • Added unit tests to verify expectations of how DSR fields ought to be updated.

Bug: T262408
Change-Id: Ic5ad2ce499bfcccec2c5d1b3ee0769a38b2a6e7e


ssastryAuthored on Sep 25 2020, 5:15 PM
rGPARfa3de33e8476: DRY out references to the default content version