)]}'
{
  "commit": "43d55e429cf72c21e9a1e60475b50feefa16fda9",
  "tree": "4bf8dac862fbededb932008e13728ba1e7fe382b",
  "parents": [
    "6693194086d657509d7bd8a29fcf15cbc8f74d7b"
  ],
  "author": {
    "name": "Lei Zhang",
    "email": "thestig@chromium.org",
    "time": "Thu Oct 22 16:08:11 2026 -0700"
  },
  "committer": {
    "name": "pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "email": "pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Thu Oct 22 16:08:11 2026 -0700"
  },
  "message": "Collapse spaces in O(n) time in CPDF_TextPage::CloseTempLine()\n\nBefore commit [1], CPDF_TextPage::CloseTempLine() collapsed consecutive\nspaces by calling WideTextBuffer::Delete(), std::deque::erase(), and\nWideString::Delete() for each duplicate space. After commit [1] switched\n`temp_char_list_` from std::deque to std::vector, erasing near the front\nof `temp_char_list_` with std::vector::erase() shifted all remaining\nelements on each duplicate space, causing O(n^2) behavior on lines with\nmany spaces.\n\nCollapse consecutive spaces in a single O(n) in-place pass over\n`temp_text_buf_` and `temp_char_list_`, truncate the unused tails of\nboth containers once, and construct `str` from the compacted\n`temp_text_buf_`. Keep the std::vector, since CLs that landed after [1]\ntook advantage of the contiguous memory allocation to switch\nCPDF_TextPage code to use spans.\n\nAlso use Clear() instead of Delete() at the end of CloseTempLine() when\nresetting `temp_text_buf_`, since deleting everything is effectively the\nsame as Clear().\n\nThis CL is AI assisted.\n\n[1] https://pdfium-review.googlesource.com/c/151031\n\nBug: 573517426\nChange-Id: I29f29779f1962699709ceb3b4ca6fd58054e5e9b\nReviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/161590\nReviewed-by: Andy Phan \u003candyphan@chromium.org\u003e\nCommit-Queue: Lei Zhang \u003cthestig@chromium.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "118051bd29333aa897c9356fd2c77bea102e6a2c",
      "old_mode": 33188,
      "old_path": "core/fpdftext/cpdf_textpage.cpp",
      "new_id": "c048ba3a8bdce5aa5e018eb423913abe2b65cf37",
      "new_mode": 33188,
      "new_path": "core/fpdftext/cpdf_textpage.cpp"
    }
  ]
}
