diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-26 13:57:00 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-11-02 11:31:01 +0000 |
commit | 1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch) | |
tree | 8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/third_party/blink/renderer/platform/image-decoders/ico | |
parent | 21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff) | |
download | qtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz |
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/image-decoders/ico')
-rw-r--r-- | chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc | 27 | ||||
-rw-r--r-- | chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h | 32 |
2 files changed, 31 insertions, 28 deletions
diff --git a/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc b/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc index 26453874cf7..51d0d088105 100644 --- a/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc +++ b/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc @@ -38,12 +38,12 @@ namespace blink { // Number of bits in .ICO/.CUR used to store the directory and its entries, // respectively (doesn't match sizeof values for member structs since we omit // some fields). -static const size_t kSizeOfDirectory = 6; -static const size_t kSizeOfDirEntry = 16; +static const wtf_size_t kSizeOfDirectory = 6; +static const wtf_size_t kSizeOfDirEntry = 16; ICOImageDecoder::ICOImageDecoder(AlphaOption alpha_option, const ColorBehavior& color_behavior, - size_t max_decoded_bytes) + wtf_size_t max_decoded_bytes) : ImageDecoder(alpha_option, ImageDecoder::kDefaultBitDepth, color_behavior, @@ -59,7 +59,7 @@ void ICOImageDecoder::OnSetData(SegmentReader* data) { if (*i) (*i)->SetData(data); } - for (size_t i = 0; i < png_decoders_.size(); ++i) + for (wtf_size_t i = 0; i < png_decoders_.size(); ++i) SetDataForPNGDecoderAtIndex(i); } @@ -67,7 +67,7 @@ IntSize ICOImageDecoder::Size() const { return frame_size_.IsEmpty() ? ImageDecoder::Size() : frame_size_; } -IntSize ICOImageDecoder::FrameSizeAtIndex(size_t index) const { +IntSize ICOImageDecoder::FrameSizeAtIndex(wtf_size_t index) const { return (index && (index < dir_entries_.size())) ? dir_entries_[index].size_ : Size(); } @@ -80,7 +80,7 @@ bool ICOImageDecoder::SetSize(unsigned width, unsigned height) { : ((IntSize(width, height) == frame_size_) || SetFailed()); } -bool ICOImageDecoder::FrameIsReceivedAtIndex(size_t index) const { +bool ICOImageDecoder::FrameIsReceivedAtIndex(wtf_size_t index) const { if (index >= dir_entries_.size()) return false; @@ -102,7 +102,8 @@ bool ICOImageDecoder::HotSpot(IntPoint& hot_spot) const { return HotSpotAtIndex(0, hot_spot); } -bool ICOImageDecoder::HotSpotAtIndex(size_t index, IntPoint& hot_spot) const { +bool ICOImageDecoder::HotSpotAtIndex(wtf_size_t index, + IntPoint& hot_spot) const { if (index >= dir_entries_.size() || file_type_ != CURSOR) return false; @@ -120,7 +121,7 @@ bool ICOImageDecoder::CompareEntries(const IconDirectoryEntry& a, : (a_entry_area > b_entry_area); } -size_t ICOImageDecoder::DecodeFrameCount() { +wtf_size_t ICOImageDecoder::DecodeFrameCount() { DecodeSize(); // If DecodeSize() fails, return the existing number of frames. This way @@ -135,7 +136,7 @@ size_t ICOImageDecoder::DecodeFrameCount() { // the file, and we still want to display these if they don't trigger decoding // failures elsewhere. if (!IsAllDataReceived()) { - for (size_t i = 0; i < dir_entries_.size(); ++i) { + for (wtf_size_t i = 0; i < dir_entries_.size(); ++i) { const IconDirectoryEntry& dir_entry = dir_entries_[i]; if ((dir_entry.image_offset_ + dir_entry.byte_size_) > data_->size()) return i; @@ -144,14 +145,14 @@ size_t ICOImageDecoder::DecodeFrameCount() { return dir_entries_.size(); } -void ICOImageDecoder::SetDataForPNGDecoderAtIndex(size_t index) { +void ICOImageDecoder::SetDataForPNGDecoderAtIndex(wtf_size_t index) { if (!png_decoders_[index]) return; png_decoders_[index]->SetData(data_.get(), IsAllDataReceived()); } -void ICOImageDecoder::Decode(size_t index, bool only_size) { +void ICOImageDecoder::Decode(wtf_size_t index, bool only_size) { if (Failed() || !data_) return; @@ -186,7 +187,7 @@ bool ICOImageDecoder::DecodeDirectory() { ProcessDirectoryEntries(); } -bool ICOImageDecoder::DecodeAtIndex(size_t index) { +bool ICOImageDecoder::DecodeAtIndex(wtf_size_t index) { SECURITY_DCHECK(index < dir_entries_.size()); const IconDirectoryEntry& dir_entry = dir_entries_[index]; const ImageType image_type = ImageTypeAtIndex(index); @@ -331,7 +332,7 @@ ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::ReadDirectoryEntry() { return entry; } -ICOImageDecoder::ImageType ICOImageDecoder::ImageTypeAtIndex(size_t index) { +ICOImageDecoder::ImageType ICOImageDecoder::ImageTypeAtIndex(wtf_size_t index) { // Check if this entry is a BMP or a PNG; we need 4 bytes to check the magic // number. SECURITY_DCHECK(data_); diff --git a/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h b/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h index 50154408df1..de58f086114 100644 --- a/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h +++ b/chromium/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h @@ -43,16 +43,20 @@ class PNGImageDecoder; // This class decodes the ICO and CUR image formats. class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { public: - ICOImageDecoder(AlphaOption, const ColorBehavior&, size_t max_decoded_bytes); + ICOImageDecoder(AlphaOption, + const ColorBehavior&, + wtf_size_t max_decoded_bytes); + ICOImageDecoder(const ICOImageDecoder&) = delete; + ICOImageDecoder& operator=(const ICOImageDecoder&) = delete; ~ICOImageDecoder() override; // ImageDecoder: String FilenameExtension() const override { return "ico"; } void OnSetData(SegmentReader*) override; IntSize Size() const override; - IntSize FrameSizeAtIndex(size_t) const override; + IntSize FrameSizeAtIndex(wtf_size_t) const override; bool SetSize(unsigned width, unsigned height) override; - bool FrameIsReceivedAtIndex(size_t) const override; + bool FrameIsReceivedAtIndex(wtf_size_t) const override; // CAUTION: SetFailed() deletes all readers and decoders. Be careful to // avoid accessing deleted memory, especially when calling this from // inside BMPImageReader! @@ -87,12 +91,12 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { // ImageDecoder: void DecodeSize() override { Decode(0, true); } - size_t DecodeFrameCount() override; - void Decode(size_t index) override { Decode(index, false); } + wtf_size_t DecodeFrameCount() override; + void Decode(wtf_size_t index) override { Decode(index, false); } // TODO (scroggo): These functions are identical to functions in // BMPImageReader. Share code? - inline uint8_t ReadUint8(size_t offset) const { + inline uint8_t ReadUint8(wtf_size_t offset) const { return fast_reader_.GetOneByte(decoded_offset_ + offset); } @@ -111,12 +115,12 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { } // If the desired PNGImageDecoder exists, gives it the appropriate data. - void SetDataForPNGDecoderAtIndex(size_t); + void SetDataForPNGDecoderAtIndex(wtf_size_t); // Decodes the entry at |index|. If |only_size| is true, stops decoding // after calculating the image size. If decoding fails but there is no // more data coming, sets the "decode failure" flag. - void Decode(size_t index, bool only_size); + void Decode(wtf_size_t index, bool only_size); // Decodes the directory and directory entries at the beginning of the // data, and initializes members. Returns true if all decoding @@ -124,7 +128,7 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { bool DecodeDirectory(); // Decodes the specified entry. - bool DecodeAtIndex(size_t); + bool DecodeAtIndex(wtf_size_t); // Processes the ICONDIR at the beginning of the data. Returns true if // the directory could be decoded. @@ -137,7 +141,7 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { // Stores the hot-spot for |index| in |hot_spot| and returns true, // or returns false if there is none. - bool HotSpotAtIndex(size_t index, IntPoint& hot_spot) const; + bool HotSpotAtIndex(wtf_size_t index, IntPoint& hot_spot) const; // Reads and returns a directory entry from the current offset into // |data|. @@ -145,14 +149,14 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { // Determines whether the desired entry is a BMP or PNG. Returns true // if the type could be determined. - ImageType ImageTypeAtIndex(size_t); + ImageType ImageTypeAtIndex(wtf_size_t); FastSharedBufferReader fast_reader_{nullptr}; // An index into |data_| representing how much we've already decoded. // Note that this only tracks data _this_ class decodes; once the // BMPImageReader takes over this will not be updated further. - size_t decoded_offset_ = 0; + wtf_size_t decoded_offset_ = 0; // Which type of file (ICO/CUR) this is. FileType file_type_; @@ -164,7 +168,7 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { // Count of directory entries is parsed from header before initializing // dir_entries_. dir_entries_ is populated only when full header // information including directory entries is available. - size_t dir_entries_count_ = 0; + wtf_size_t dir_entries_count_ = 0; // The image decoders for the various frames. typedef Vector<std::unique_ptr<BMPImageReader>> BMPReaders; @@ -175,8 +179,6 @@ class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { // Valid only while a BMPImageReader is decoding, this holds the size // for the particular entry being decoded. IntSize frame_size_; - - DISALLOW_COPY_AND_ASSIGN(ICOImageDecoder); }; } // namespace blink |