diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp index eaad87096e4f5a98b4f6928235e38af6664c4091..29db5a4fda8ce0198738e162b0986e83bd149e92 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; diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index e8e79d827670517a5aa0c8564e923fcd21a12d32..e0ecd882d37404d5d3d02339513158aebab8b97e 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; diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 027a5524ff63819193de78d1d68f88b052370619..2fc82392b77b13b343b0afd1331173cf4ff0277c 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"); @@ -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(); diff --git a/core/fpdfdoc/cpdf_structtree.cpp b/core/fpdfdoc/cpdf_structtree.cpp index 5c99a8385827ace7c98a430b855bde84f03eff49..67ac9485fb7de10105b571d856043c7474d6afca 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()); diff --git a/core/fxcrt/fx_folder_posix.cpp b/core/fxcrt/fx_folder_posix.cpp index 284927fd8ef36e0e1b273fe17b391f40eaf0b85e..b4cf9f9ec681b6ce405ef657b2ca113020a4a98a 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; } diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn index 9a9c92f0788286ba2cba10525c836dfeae78e5e5..a21a6d3e89d5fd08c70fccb3ffa2261104925380 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" ] } diff --git a/third_party/libtiff/tif_close.c b/third_party/libtiff/tif_close.c index d08e673b37403cf9f4c19ddae70edcfda072cc83..06aa29f56f7ee20af177b8cf8062660177c86625 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); } diff --git a/third_party/libtiff/tif_luv.c b/third_party/libtiff/tif_luv.c index fcaacec6a0cc600ea5c91bce4de3b9ab36a49ab2..051721e8201cf82483a0d0f506c0458ebc7f4bb9 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); diff --git a/third_party/libtiff/tif_lzw.c b/third_party/libtiff/tif_lzw.c index d631fa10494032ce23f75789ee865bbb3c10ea9b..ba75a07edcb690376a3e923d38a42529d28311e8 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);