Get rid of false DCHECK from ReusingTextShaper::CollectReusableShapeResults()
This patch gets rid of false |DCHECK_LE(start_offset, item->StartOffset())| from |ReusingTextShaper::CollectReusableShapeResults()| when inserted text starts with newline character as control character, e.g. white-space:pre, <pre>, etc. This DCHECK is wrong when adding newline chracter as control character, e.g. appending "\nX" to "n". In |ReusingTextShaper|, we have two items in |reusable_items_|. * reusable_items_[0] = kText 0-1 "n", shape_result=avaiable * reusable_items_[1] = kText 1-3 "\nX", shape_result=null Shaping items are * items[0] = kText 0-1 "n", shape_result=reused * items[1] = kControl 1-2 "\n", shape_result=n/a * items[2] = kText 2-3 "X", shape_result=new When |ReusingTextShaper| to shape for "X", |DCHECK| hits for handling |reusable_items_[1]|, because |start_offset| is 2 and |item->StartOffset()| is 1. Bug: 1003666 Change-Id: I800fae637ff7a39b0e65d07699c07b204051399e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824516 Auto-Submit: Yoshifumi Inoue <yosin@chromium.org> Reviewed-by:Emil A Eklund <eae@chromium.org> Commit-Queue: Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#700111}
Showing
Please register or sign in to comment