Fix live editing overlap for LTR text following RTL text Explicitly check sTextBuf.IsEmpty() in CPWL_EditImpl::DrawEdit() to force a reset of the continuous rendering run state. Update the base placement coordinates for new character sequences even when the text buffer is empty, preventing newly typed text from incorrectly inheriting stale coordinates from the previous run. On the testing side, the baseline expected bitmaps for embedder tests are updated. Previously, trailing Left-To-Right glyph was drawn at coordinates overlapping the preceding Right-To-Left text run. Updated images verify the trailing LTR character's placement coordinate correctly advances past the bounding box of the RTL run. Bug: 535730401 Change-Id: I430abe2255f38a739488313b7f7a2b1c304ac857 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/152290 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Seung Hyun Jin <seunghyunjin@google.com>
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp index 88a19de..cb8bddb 100644 --- a/fpdfsdk/fpdf_formfill_embeddertest.cpp +++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -1670,7 +1670,6 @@ TypeCharactersIntoTextField(kInput, RegularFormBegin()); ScopedFPDFBitmap bitmap = RenderLoadedPage(page()); - // TODO(crbug.com/535730401): Fix the overlapping text issue. CompareBitmapWithExpectationSuffix(bitmap.get(), "bug_535730401"); } @@ -1754,7 +1753,6 @@ TypeCharactersIntoTextField(kInput, EditableFormBegin()); ScopedFPDFBitmap bitmap = RenderLoadedPage(page()); - // TODO(crbug.com/535730401): Fix the overlapping text issue. CompareBitmapWithExpectationSuffix(bitmap.get(), "bug_535730401_combobox"); }
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index 1cb2e16..5ff7b63 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -671,7 +671,7 @@ int32_t font_index = word.font_index(); if (bContinuous && !word.is_rtl()) { if (place.LineCmp(oldplace) != 0 || font_index != nFontIndex || - crOldFill != crCurFill) { + crOldFill != crCurFill || sTextBuf.IsEmpty()) { if (!sTextBuf.IsEmpty()) { DrawTextString(pDevice, ptBT + ptOffset, font_map->GetPDFFont(nFontIndex).Get(), fFontSize,
diff --git a/testing/resources/embedder_tests/bug_535730401.png b/testing/resources/embedder_tests/bug_535730401.png index fa1e567..9cd89de 100644 --- a/testing/resources/embedder_tests/bug_535730401.png +++ b/testing/resources/embedder_tests/bug_535730401.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_agg_mac.png b/testing/resources/embedder_tests/bug_535730401_agg_mac.png index cf3e073..058d64c 100644 --- a/testing/resources/embedder_tests/bug_535730401_agg_mac.png +++ b/testing/resources/embedder_tests/bug_535730401_agg_mac.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox.png b/testing/resources/embedder_tests/bug_535730401_combobox.png index b3721b7..72d69ab 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox_agg_mac.png b/testing/resources/embedder_tests/bug_535730401_combobox_agg_mac.png index 58c5e37..773133b 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox_agg_mac.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox_agg_mac.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox_mac.png b/testing/resources/embedder_tests/bug_535730401_combobox_mac.png index c332b82..fefe2c7 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox_mac.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox_mac.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox_skia_linux.png b/testing/resources/embedder_tests/bug_535730401_combobox_skia_linux.png index c83c859..6a16f31 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox_skia_linux.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox_skia_linux.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox_skia_mac.png b/testing/resources/embedder_tests/bug_535730401_combobox_skia_mac.png index c758c92..d0f9f49 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox_skia_mac.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox_skia_mac.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox_skia_win.png b/testing/resources/embedder_tests/bug_535730401_combobox_skia_win.png index ffd089c..c6699a3 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox_skia_win.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox_skia_win.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_combobox_win.png b/testing/resources/embedder_tests/bug_535730401_combobox_win.png index b3721b7..72d69ab 100644 --- a/testing/resources/embedder_tests/bug_535730401_combobox_win.png +++ b/testing/resources/embedder_tests/bug_535730401_combobox_win.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_mac.png b/testing/resources/embedder_tests/bug_535730401_mac.png index 2657f29..7be3560 100644 --- a/testing/resources/embedder_tests/bug_535730401_mac.png +++ b/testing/resources/embedder_tests/bug_535730401_mac.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_skia_linux.png b/testing/resources/embedder_tests/bug_535730401_skia_linux.png index 888a294..58b1d20 100644 --- a/testing/resources/embedder_tests/bug_535730401_skia_linux.png +++ b/testing/resources/embedder_tests/bug_535730401_skia_linux.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_skia_mac.png b/testing/resources/embedder_tests/bug_535730401_skia_mac.png index 3438878..20f5704 100644 --- a/testing/resources/embedder_tests/bug_535730401_skia_mac.png +++ b/testing/resources/embedder_tests/bug_535730401_skia_mac.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_skia_win.png b/testing/resources/embedder_tests/bug_535730401_skia_win.png index 9524ef3..fa6a6fc 100644 --- a/testing/resources/embedder_tests/bug_535730401_skia_win.png +++ b/testing/resources/embedder_tests/bug_535730401_skia_win.png Binary files differ
diff --git a/testing/resources/embedder_tests/bug_535730401_win.png b/testing/resources/embedder_tests/bug_535730401_win.png index fa1e567..9cd89de 100644 --- a/testing/resources/embedder_tests/bug_535730401_win.png +++ b/testing/resources/embedder_tests/bug_535730401_win.png Binary files differ