Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ default_args = {
# PDFium does not include the temporal_rs library.
v8_enable_temporal_support = false

# PDFium does not use ICU4X implementations for ECMA-402 features.
v8_enable_ecma402_icu4x = false

# PDFium has its own unsafe-buffers enforcement directories.
clang_unsafe_buffers_paths = "//unsafe_buffers_paths.txt"

Expand Down
42 changes: 11 additions & 31 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling catapult
# and whatever else without interference from each other.
'catapult_revision': 'e1165abbf12a3d9ecf2d3151a404c930b5047894',
'catapult_revision': 'c29dedc30c9ff1b0cc677e32a9a959ad5ed41bde',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling clang format
# and whatever else without interference from each other.
Expand Down Expand Up @@ -134,7 +134,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling fast_float
# and whatever else without interference from each other.
'fast_float_revision': 'b0ab987b3dfdde13fa1915f65ef2a5c068d9208c',
'fast_float_revision': '42f254836ee416ffcf2f4e6576260003ac33d48c',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling fp16
# and whatever else without interference from each other.
Expand All @@ -154,7 +154,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling gtest
# and whatever else without interference from each other.
'gtest_revision': '4fe3307fb2d9f86d19777c7eb0e4809e9694dde7',
'gtest_revision': '0b656495436f57212be8700794a3d5fb14000c5f',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling HarfBuzz
# and whatever else without interference from each other.
Expand All @@ -166,15 +166,15 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling icu
# and whatever else without interference from each other.
'icu_revision': '5aa526207171ecadf31597f0980a7b7ad8872f33',
'icu_revision': 'a0ea93436c528ca316a6e698e483e258839101a5',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling instrumented_lib
# and whatever else without interference from each other.
'instrumented_lib_revision': '83128b60913a82a39d01055312687a27bb959b59',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling jinja2
# and whatever else without interference from each other.
'jinja2_revision': 'c3027d884967773057bf74b957e3fea87e5df4d7',
'jinja2_revision': 'fde3c16799bd5937e4f15aedc9037c89f96236b9',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling jpeg_turbo
# and whatever else without interference from each other.
Expand Down Expand Up @@ -204,7 +204,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling llvm-libc
# and whatever else without interference from each other.
'llvm_libc_revision': '14e51fd2cd7ec21294f18a3a0b2fc5339afea271',
'llvm_libc_revision': 'd8f2045008e230f3c5f50095d918c11f1997e477',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling markupsafe
# and whatever else without interference from each other.
Expand Down Expand Up @@ -244,7 +244,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling skia
# and whatever else without interference from each other.
'skia_revision': '0abfcf118530e0e46e7e466f6d028041af61581a',
'skia_revision': '607de4b035dcf7fdbaafb66c6cc04f22009ff4d4',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling test_fonts
# and whatever else without interference from each other.
Expand All @@ -264,15 +264,15 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling tools_win_revision
# and whatever else without interference from each other.
'tools_win_revision': 'ae34cdd9867c5d2b185fadc9d4a9cc82bb741760',
'tools_win_revision': 'd72db9e3040567a7589e00c0ad7ddf25c3b070bc',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling v8
# and whatever else without interference from each other.
'v8_revision': '0d546234ecf0af2032e958300ef8aeb14bc716c9',
'v8_revision': 'bb54fc4e853a1ef1640b160e5e854d0a3b514e29',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling zlib
# and whatever else without interference from each other.
'zlib_revision': '456ae730017b9b4bd3371927abc82627fd51feef',
'zlib_revision': '9f9f52c60a14e8e772fb561029ae0a121fef7609',
}

# Only these hosts are allowed for dependencies in this DEPS file.
Expand Down Expand Up @@ -1005,31 +1005,13 @@ hooks = [
},
# Configure remote exec cfg files
{
# Use luci_auth if on windows and using chrome-untrusted project
'name': 'download_and_configure_reclient_cfgs',
'pattern': '.',
'condition': 'download_remoteexec_cfg and host_os == "win"',
'condition': 'download_remoteexec_cfg',
'action': ['python3',
'buildtools/reclient_cfgs/configure_reclient_cfgs.py',
'--rbe_instance',
Var('rbe_instance'),
'--reproxy_cfg_template',
'reproxy.cfg.template',
'--rewrapper_cfg_project',
Var('rewrapper_cfg_project'),
'--use_luci_auth_credshelper',
'--quiet',
],
}, {
'name': 'download_and_configure_reclient_cfgs',
'pattern': '.',
'condition': 'download_remoteexec_cfg and not host_os == "win"',
'action': ['python3',
'buildtools/reclient_cfgs/configure_reclient_cfgs.py',
'--rbe_instance',
Var('rbe_instance'),
'--reproxy_cfg_template',
'reproxy.cfg.template',
'--rewrapper_cfg_project',
Var('rewrapper_cfg_project'),
'--quiet',
Expand All @@ -1043,8 +1025,6 @@ hooks = [
'buildtools/reclient_cfgs/configure_reclient_cfgs.py',
'--rbe_instance',
Var('rbe_instance'),
'--reproxy_cfg_template',
'reproxy.cfg.template',
'--rewrapper_cfg_project',
Var('rewrapper_cfg_project'),
'--skip_remoteexec_cfg_fetch',
Expand Down
7 changes: 3 additions & 4 deletions core/fpdfapi/edit/cpdf_image_redactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,9 @@ std::optional<Decoded> Decode(CPDF_Document* doc,
// CPDF_DIB reads both only when it loads the image's mask.
const bool load_mask = inline_alpha || matte;
auto dib = pdfium::MakeRetain<CPDF_DIB>(doc, std::move(stream));
CPDF_DIB::LoadState state =
dib->StartLoadDIBBase(load_mask, resources, page_resources,
/*bStdCS=*/false, CPDF_ColorSpace::Family::kUnknown,
/*bLoadMask=*/load_mask, CFX_Size());
CPDF_DIB::LoadState state = dib->StartLoadDIBBase(
load_mask, resources, page_resources, CPDF_ColorSpace::Family::kUnknown,
/*bLoadMask=*/load_mask, CFX_Size());
while (state == CPDF_DIB::LoadState::kContinue) {
state = dib->ContinueLoadDIBBase(nullptr);
}
Expand Down
7 changes: 0 additions & 7 deletions core/fpdfapi/page/cpdf_basedcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@
CPDF_BasedCS::CPDF_BasedCS(Family family) : CPDF_ColorSpace(family) {}

CPDF_BasedCS::~CPDF_BasedCS() = default;

void CPDF_BasedCS::EnableStdConversion(bool bEnabled) {
CPDF_ColorSpace::EnableStdConversion(bEnabled);
if (base_cs_) {
base_cs_->EnableStdConversion(bEnabled);
}
}
2 changes: 0 additions & 2 deletions core/fpdfapi/page/cpdf_basedcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class CPDF_BasedCS : public CPDF_ColorSpace {
CONSTRUCT_VIA_MAKE_RETAIN;
~CPDF_BasedCS() override;

void EnableStdConversion(bool bEnabled) final;

protected:
explicit CPDF_BasedCS(Family family);

Expand Down
43 changes: 19 additions & 24 deletions core/fpdfapi/page/cpdf_colorspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class CPDF_CalGray final : public CPDF_ColorSpace {
int pixels,
int image_width,
int image_height,
bool bTransMask) const override;
bool is_transparency_mask) const override;

private:
static constexpr float kDefaultGamma = 1.0f;
Expand All @@ -161,7 +161,7 @@ class CPDF_CalRGB final : public CPDF_ColorSpace {
int pixels,
int image_width,
int image_height,
bool bTransMask) const override;
bool is_transparency_mask) const override;
uint32_t v_Load(CPDF_Document* doc,
const CPDF_Array* pArray,
std::set<const CPDF_Object*>* pVisited) override;
Expand Down Expand Up @@ -195,7 +195,7 @@ class CPDF_LabCS final : public CPDF_ColorSpace {
int pixels,
int image_width,
int image_height,
bool bTransMask) const override;
bool is_transparency_mask) const override;
uint32_t v_Load(CPDF_Document* doc,
const CPDF_Array* pArray,
std::set<const CPDF_Object*>* pVisited) override;
Expand Down Expand Up @@ -224,7 +224,7 @@ class CPDF_ICCBasedCS final : public CPDF_BasedCS {
int pixels,
int image_width,
int image_height,
bool bTransMask) const override;
bool is_transparency_mask) const override;
bool IsNormal() const override;
uint32_t v_Load(CPDF_Document* doc,
const CPDF_Array* pArray,
Expand Down Expand Up @@ -641,10 +641,9 @@ void CPDF_ColorSpace::TranslateImageLine(pdfium::span<uint8_t> dest_span,
int pixels,
int image_width,
int image_height,
bool bTransMask) const {
// Only applies to CMYK colorspaces. None of the colorspaces that use this
// generic base implementation are CMYK.
CHECK(!bTransMask);
bool is_transparency_mask) const {
// Transparency masks are only used with CMYK colorspaces, not base CS.
CHECK(!is_transparency_mask);

uint8_t* dest_buf = dest_span.data();
const uint8_t* src_buf = src_span.data();
Expand All @@ -663,14 +662,6 @@ void CPDF_ColorSpace::TranslateImageLine(pdfium::span<uint8_t> dest_span,
});
}

void CPDF_ColorSpace::EnableStdConversion(bool bEnabled) {
if (bEnabled) {
std_conversion_++;
} else if (std_conversion_) {
std_conversion_--;
}
}

bool CPDF_ColorSpace::IsNormal() const {
return GetFamily() == Family::kDeviceGray ||
GetFamily() == Family::kDeviceRGB ||
Expand Down Expand Up @@ -730,8 +721,9 @@ void CPDF_CalGray::TranslateImageLine(pdfium::span<uint8_t> dest_span,
int pixels,
int image_width,
int image_height,
bool bTransMask) const {
CHECK(!bTransMask); // Only applies to CMYK colorspaces.
bool is_transparency_mask) const {
// Transparency masks are only used with CMYK colorspaces, not CalGray.
CHECK(!is_transparency_mask);

auto gray_span = src_span.first(static_cast<size_t>(pixels));
auto rgb_span = fxcrt::reinterpret_span<FX_RGB_STRUCT<uint8_t>>(dest_span);
Expand Down Expand Up @@ -813,8 +805,9 @@ void CPDF_CalRGB::TranslateImageLine(pdfium::span<uint8_t> dest_span,
int pixels,
int image_width,
int image_height,
bool bTransMask) const {
CHECK(!bTransMask); // Only applies to CMYK colorspaces.
bool is_transparency_mask) const {
// Transparency masks are only used with CMYK colorspaces, not CalRGB.
CHECK(!is_transparency_mask);
fxcodec::ReverseRGB(dest_span, src_span, pixels);
}

Expand Down Expand Up @@ -904,8 +897,9 @@ void CPDF_LabCS::TranslateImageLine(pdfium::span<uint8_t> dest_span,
int pixels,
int image_width,
int image_height,
bool bTransMask) const {
CHECK(!bTransMask); // Only applies to CMYK colorspaces.
bool is_transparency_mask) const {
// Transparency masks are only used with CMYK colorspaces, not Lab.
CHECK(!is_transparency_mask);

auto bgr_span = fxcrt::reinterpret_span<FX_BGR_STRUCT<uint8_t>>(dest_span);
auto lab_span =
Expand Down Expand Up @@ -996,8 +990,9 @@ void CPDF_ICCBasedCS::TranslateImageLine(pdfium::span<uint8_t> dest_span,
int pixels,
int image_width,
int image_height,
bool bTransMask) const {
CHECK(!bTransMask); // Only applies to CMYK colorspaces.
bool is_transparency_mask) const {
// Transparency masks are only used with CMYK colorspaces, not ICCBased.
CHECK(!is_transparency_mask);

if (profile_->IsSRGB()) {
fxcodec::ReverseRGB(dest_span, src_span, pixels);
Expand Down
5 changes: 1 addition & 4 deletions core/fpdfapi/page/cpdf_colorspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ class CPDF_ColorSpace : public Retainable, public Observable {
int pixels,
int image_width,
int image_height,
bool bTransMask) const;
virtual void EnableStdConversion(bool bEnabled);
bool is_transparency_mask) const;
virtual bool IsNormal() const;

// Returns `this` as a CPDF_PatternCS* if `this` is a pattern.
Expand All @@ -149,7 +148,6 @@ class CPDF_ColorSpace : public Retainable, public Observable {
// components count.
void SetComponentsForStockCS(uint32_t nComponents);

bool IsStdConversionEnabled() const { return std_conversion_ != 0; }
bool HasSameArray(const CPDF_Object* pObj) const { return array_ == pObj; }

private:
Expand All @@ -160,7 +158,6 @@ class CPDF_ColorSpace : public Retainable, public Observable {
ByteStringView bsFamilyName);

const Family family_;
uint32_t std_conversion_ = 0;
uint32_t components_ = 0;
RetainPtr<const CPDF_Array> array_;
};
Expand Down
8 changes: 4 additions & 4 deletions core/fpdfapi/page/cpdf_colorspace_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ TEST(CPDFCalGrayTest, TranslateImageLine) {
const uint8_t kSrc[12] = {255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128};
uint8_t dst[12];
std::ranges::fill(dst, 0xbd);
// `bTransMask` only applies to CYMK colorspaces.
pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*bTransMask=*/false);
// Transparency masks are only used with CMYK colorspaces, not CalGray.
pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*is_transparency_mask=*/false);
EXPECT_THAT(dst, ElementsAre(255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}

Expand All @@ -34,7 +34,7 @@ TEST(CPDFCalRGBTest, TranslateImageLine) {
const uint8_t kSrc[12] = {255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128};
uint8_t dst[12];
std::ranges::fill(dst, 0xbd);
// `bTransMask` only applies to CYMK colorspaces.
pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*bTransMask=*/false);
// Transparency masks are only used with CMYK colorspaces, not CalRGB.
pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*is_transparency_mask=*/false);
EXPECT_THAT(dst, ElementsAre(0, 0, 255, 0, 255, 0, 255, 0, 0, 128, 128, 128));
}
23 changes: 10 additions & 13 deletions core/fpdfapi/page/cpdf_decodedimagestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ struct CPDF_DecodedImageStore::Entry {
const size_t bytes;
};

CPDF_DecodedImageStore::Key::Key(RetainPtr<const CPDF_Stream> stream,
const CPDF_Document* document,
RetainPtr<const CPDF_Dictionary> page_resources,
bool std_cs,
CPDF_ColorSpace::Family family,
bool load_mask)
CPDF_DecodedImageStore::Key::Key(
RetainPtr<const CPDF_Stream> stream,
const CPDF_Document* document,
RetainPtr<const CPDF_Dictionary> page_resources,
CPDF_ColorSpace::Family family,
bool load_mask)
: stream_(std::move(stream)),
page_resources_(std::move(page_resources)),
document_(reinterpret_cast<uintptr_t>(document)),
std_cs_(std_cs),
family_(family),
load_mask_(load_mask) {}

Expand All @@ -67,10 +66,9 @@ CPDF_DecodedImageStore::Key& CPDF_DecodedImageStore::Key::operator=(
CPDF_DecodedImageStore::Key::~Key() = default;

bool CPDF_DecodedImageStore::Key::operator<(const Key& that) const {
return std::tie(stream_, page_resources_, document_, std_cs_, family_,
load_mask_) < std::tie(that.stream_, that.page_resources_,
that.document_, that.std_cs_,
that.family_, that.load_mask_);
return std::tie(stream_, page_resources_, document_, family_, load_mask_) <
std::tie(that.stream_, that.page_resources_, that.document_,
that.family_, that.load_mask_);
}

CPDF_DecodedImageStore::Decoded::Decoded() = default;
Expand Down Expand Up @@ -100,7 +98,6 @@ CPDF_DecodedImageStore* CPDF_DecodedImageStore::Get() {
std::optional<CPDF_DecodedImageStore::Key> CPDF_DecodedImageStore::KeyFor(
const CPDF_Image& image,
const CPDF_Dictionary* page_resources,
bool std_cs,
CPDF_ColorSpace::Family family,
bool load_mask) {
CPDF_DecodedImageStore* store = Get();
Expand All @@ -114,7 +111,7 @@ std::optional<CPDF_DecodedImageStore::Key> CPDF_DecodedImageStore::KeyFor(
return std::nullopt;
}
return Key(std::move(stream), image.GetDocument(),
pdfium::WrapRetain(page_resources), std_cs, family, load_mask);
pdfium::WrapRetain(page_resources), family, load_mask);
}

CPDF_DecodedImageStore::CPDF_DecodedImageStore() = default;
Expand Down
Loading