From dffb5439af6a1a30c7eeb439193cfe40992dbb29 Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:34:36 +0000 Subject: [PATCH 01/10] update core/fpdfapi/page/cpdf_dib.cpp. Signed-off-by: taoxueao --- core/fpdfapi/page/cpdf_dib.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp index eaad870..29db5a4 100644 --- a/core/fpdfapi/page/cpdf_dib.cpp +++ b/core/fpdfapi/page/cpdf_dib.cpp @@ -704,10 +704,10 @@ RetainPtr CPDF_DIB::LoadJpxBitmap( format = FXDIB_Format::k8bppRgb; } else if (action == JpxDecodeAction::kUseRgb && image_info.channels == 3) { format = FXDIB_Format::kRgb; - } else if (action == JpxDecodeAction::kUseRgb && image_info.channels == 4) { + } else if (action == JpxDecodeAction::kConvertArgbToRgb && + image_info.channels == 4) { format = FXDIB_Format::kRgb32; - } else if (action == JpxDecodeAction::kConvertArgbToRgb) { - CHECK_GE(image_info.channels, 4); + } else if (action == JpxDecodeAction::kUseRgb && image_info.channels == 4) { format = FXDIB_Format::kRgb32; } else { image_info.width = (image_info.width * image_info.channels + 2) / 3; -- Gitee From 3231b88b73f3112f8ba9366e750111ee689a4121 Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:35:24 +0000 Subject: [PATCH 02/10] update core/fpdfdoc/cpdf_annot.cpp. Signed-off-by: taoxueao --- core/fpdfdoc/cpdf_annot.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index e8e79d8..e0ecd88 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -54,7 +54,6 @@ CPDF_Form* AnnotGetMatrix(CPDF_Page* pPage, form_matrix.TransformRect(pForm->GetDict()->GetRectFor("BBox")); matrix->MatchRect(pAnnot->GetRect(), form_bbox); -#if !BUILDFLAG(IS_OHOS) // Compensate for page rotation. if ((pAnnot->GetFlags() & pdfium::annotation_flags::kNoRotate) && pPage->GetPageRotation() != 0) { @@ -68,7 +67,6 @@ CPDF_Form* AnnotGetMatrix(CPDF_Page* pPage, matrix->Rotate(angle); matrix->Concat({1, 0, 0, 1, offset_x, offset_y}); } -#endif matrix->Concat(mtUser2Device); return pForm; -- Gitee From 05bfac427bbd3cfc0658dc79b390194a30e58ca9 Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:37:20 +0000 Subject: [PATCH 03/10] update core/fpdfdoc/cpdf_annotlist.cpp. Signed-off-by: taoxueao --- core/fpdfdoc/cpdf_annotlist.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 027a552..9fc7e54 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -79,13 +79,13 @@ std::unique_ptr CreatePopupAnnot(CPDF_Document* pDocument, if (!pParentDict) return nullptr; - // TODO(crbug.com/pdfium/1098): Determine if we really need to check if - // /Contents is empty or not. If so, optimize decoding for empty check. - ByteString contents = - pParentDict->GetByteStringFor(pdfium::annotation::kContents); - if (PDF_DecodeText(contents.raw_span()).IsEmpty()) { + // TODO(jaepark): We shouldn't strip BOM for some strings and not for others. + // See pdfium:593. + WideString sContents = + pParentDict->GetUnicodeTextFor(pdfium::annotation::kContents); + if (sContents.IsEmpty()) return nullptr; - } + auto pAnnotDict = pDocument->New(); pAnnotDict->SetNewFor(pdfium::annotation::kType, "Annot"); -- Gitee From 2b9848678c682bbebd86564fbfeeabd3d9220b3b Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:40:01 +0000 Subject: [PATCH 04/10] update core/fpdfdoc/cpdf_structtree.cpp. Signed-off-by: taoxueao --- core/fpdfdoc/cpdf_structtree.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/fpdfdoc/cpdf_structtree.cpp b/core/fpdfdoc/cpdf_structtree.cpp index 5c99a83..67ac948 100644 --- a/core/fpdfdoc/cpdf_structtree.cpp +++ b/core/fpdfdoc/cpdf_structtree.cpp @@ -124,10 +124,8 @@ RetainPtr CPDF_StructTree::AddPageNode( if (!pParentElement) return pElement; - if (!pParentElement->UpdateKidIfElement(pDict, pElement.Get())) { + if (!pParentElement->UpdateKidIfElement(pDict, pElement.Get())) map->erase(key); - return pElement; - } pElement->SetParent(pParentElement.Get()); -- Gitee From 1eaa9091fdd1b58e836948540213eb0bf8847d4d Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:41:02 +0000 Subject: [PATCH 05/10] update core/fxcrt/fx_folder_posix.cpp. Signed-off-by: taoxueao --- core/fxcrt/fx_folder_posix.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/fxcrt/fx_folder_posix.cpp b/core/fxcrt/fx_folder_posix.cpp index 284927f..b4cf9f9 100644 --- a/core/fxcrt/fx_folder_posix.cpp +++ b/core/fxcrt/fx_folder_posix.cpp @@ -57,15 +57,10 @@ bool FX_PosixFolder::GetNextFile(ByteString* filename, bool* bFolder) { ByteString fullpath = m_Path + "/" + de->d_name; struct stat deStat; - ByteString file = de->d_name; - if ( -#if BUILDFLAG(IS_OHOS) - !(file == "." || file == "..") && -#endif - stat(fullpath.c_str(), &deStat) < 0) + if (stat(fullpath.c_str(), &deStat) < 0) return false; - *filename = file; + *filename = de->d_name; *bFolder = S_ISDIR(deStat.st_mode); return true; } -- Gitee From 1f243bc425e7ba2e9235d88eb61ab74338a4585b Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:42:01 +0000 Subject: [PATCH 06/10] update core/fxge/BUILD.gn. Signed-off-by: taoxueao --- core/fxge/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn index 9a9c92f..a21a6d3 100644 --- a/core/fxge/BUILD.gn +++ b/core/fxge/BUILD.gn @@ -138,7 +138,7 @@ source_set("fxge") { public_deps += [ "//skia" ] } - if (is_android || is_ohos) { + if (is_android) { sources += [ "android/cfpf_skiadevicemodule.cpp", "android/cfpf_skiadevicemodule.h", @@ -154,7 +154,7 @@ source_set("fxge") { ] } - if (is_linux || is_chromeos || is_fuchsia) { + if (is_linux || is_chromeos || is_fuchsia || is_ohos) { sources += [ "linux/fx_linux_impl.cpp" ] } -- Gitee From bc07adc41ea57d44d9a346e77a3279cddc61863f Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:44:06 +0000 Subject: [PATCH 07/10] update third_party/libtiff/tif_close.c. Signed-off-by: taoxueao --- third_party/libtiff/tif_close.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/third_party/libtiff/tif_close.c b/third_party/libtiff/tif_close.c index d08e673..06aa29f 100644 --- a/third_party/libtiff/tif_close.c +++ b/third_party/libtiff/tif_close.c @@ -130,12 +130,9 @@ void TIFFCleanup(TIFF *tif) void TIFFClose(TIFF *tif) { - if (tif != NULL) - { - TIFFCloseProc closeproc = tif->tif_closeproc; - thandle_t fd = tif->tif_clientdata; + TIFFCloseProc closeproc = tif->tif_closeproc; + thandle_t fd = tif->tif_clientdata; - TIFFCleanup(tif); - (void)(*closeproc)(fd); - } + TIFFCleanup(tif); + (void)(*closeproc)(fd); } -- Gitee From 7b5a63290ac67686a0cf710a3cd969d0a2a6e424 Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:45:57 +0000 Subject: [PATCH 08/10] update third_party/libtiff/tif_luv.c. Signed-off-by: taoxueao --- third_party/libtiff/tif_luv.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/third_party/libtiff/tif_luv.c b/third_party/libtiff/tif_luv.c index fcaacec..051721e 100644 --- a/third_party/libtiff/tif_luv.c +++ b/third_party/libtiff/tif_luv.c @@ -953,13 +953,6 @@ static { register int vi, ui; -/* check for NaN */ - if (u != u || v != v) - { - u = U_NEU; - v = V_NEU; - } - if (v < UV_VSTART) return oog_encode(u, v); vi = tiff_itrunc((v - UV_VSTART) * (1. / UV_SQSIZ), em); -- Gitee From 3c62542f05a422a04c6e0ffc07b44456437514f4 Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 13:47:04 +0000 Subject: [PATCH 09/10] update third_party/libtiff/tif_lzw.c. Signed-off-by: taoxueao --- third_party/libtiff/tif_lzw.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/third_party/libtiff/tif_lzw.c b/third_party/libtiff/tif_lzw.c index d631fa1..ba75a07 100644 --- a/third_party/libtiff/tif_lzw.c +++ b/third_party/libtiff/tif_lzw.c @@ -423,10 +423,6 @@ static int LZWDecode(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s) if (sp->read_error) { - TIFFErrorExtR(tif, module, - "LZWDecode: Scanline %" PRIu32 " cannot be read due to " - "previous error", - tif->tif_row); return 0; } @@ -746,7 +742,6 @@ after_loop: return (1); no_eoi: - sp->read_error = 1; TIFFErrorExtR(tif, module, "LZWDecode: Strip %" PRIu32 " not terminated with EOI code", tif->tif_curstrip); -- Gitee From e0cb679f4c6ce5b9767baf475a5dc4e8138d7a40 Mon Sep 17 00:00:00 2001 From: taoxueao Date: Thu, 5 Dec 2024 14:28:20 +0000 Subject: [PATCH 10/10] update core/fpdfdoc/cpdf_annotlist.cpp. Signed-off-by: taoxueao --- core/fpdfdoc/cpdf_annotlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 9fc7e54..2fc8239 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -93,8 +93,8 @@ std::unique_ptr CreatePopupAnnot(CPDF_Document* pDocument, pAnnotDict->SetNewFor( pdfium::form_fields::kT, pParentDict->GetByteStringFor(pdfium::form_fields::kT), false); - pAnnotDict->SetNewFor(pdfium::annotation::kContents, contents, - /*bHex=*/false); + pAnnotDict->SetNewFor(pdfium::annotation::kContents, + sContents.ToUTF8(), false); CFX_FloatRect rect = pParentDict->GetRectFor(pdfium::annotation::kRect); rect.Normalize(); -- Gitee