Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: Source/core/html/ImageDocument.cpp

Issue 618583002: Correct data size argument type in resource loading path to unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add static_cast to RELEASE_ASSERT in AssociatedURLLoader::ClientAdapter::didReceiveData Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.cpp ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 25 matching lines...) Expand all
36 #include "core/frame/Settings.h" 36 #include "core/frame/Settings.h"
37 #include "core/html/HTMLBodyElement.h" 37 #include "core/html/HTMLBodyElement.h"
38 #include "core/html/HTMLHeadElement.h" 38 #include "core/html/HTMLHeadElement.h"
39 #include "core/html/HTMLHtmlElement.h" 39 #include "core/html/HTMLHtmlElement.h"
40 #include "core/html/HTMLImageElement.h" 40 #include "core/html/HTMLImageElement.h"
41 #include "core/html/HTMLMetaElement.h" 41 #include "core/html/HTMLMetaElement.h"
42 #include "core/loader/DocumentLoader.h" 42 #include "core/loader/DocumentLoader.h"
43 #include "core/loader/FrameLoader.h" 43 #include "core/loader/FrameLoader.h"
44 #include "core/loader/FrameLoaderClient.h" 44 #include "core/loader/FrameLoaderClient.h"
45 #include "wtf/text/StringBuilder.h" 45 #include "wtf/text/StringBuilder.h"
46 #include <limits>
46 47
47 using std::min; 48 using std::min;
48 49
49 namespace blink { 50 namespace blink {
50 51
51 using namespace HTMLNames; 52 using namespace HTMLNames;
52 53
53 class ImageEventListener : public EventListener { 54 class ImageEventListener : public EventListener {
54 public: 55 public:
55 static PassRefPtr<ImageEventListener> create(ImageDocument* document) { retu rn adoptRef(new ImageEventListener(document)); } 56 static PassRefPtr<ImageEventListener> create(ImageDocument* document) { retu rn adoptRef(new ImageEventListener(document)); }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void ImageDocumentParser::appendBytes(const char* data, size_t length) 122 void ImageDocumentParser::appendBytes(const char* data, size_t length)
122 { 123 {
123 if (!length) 124 if (!length)
124 return; 125 return;
125 126
126 LocalFrame* frame = document()->frame(); 127 LocalFrame* frame = document()->frame();
127 Settings* settings = frame->settings(); 128 Settings* settings = frame->settings();
128 if (!frame->loader().client()->allowImage(!settings || settings->imagesEnabl ed(), document()->url())) 129 if (!frame->loader().client()->allowImage(!settings || settings->imagesEnabl ed(), document()->url()))
129 return; 130 return;
130 131
131 if (document()->cachedImage()) 132 if (document()->cachedImage()) {
133 RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max());
132 document()->cachedImage()->appendData(data, length); 134 document()->cachedImage()->appendData(data, length);
135 }
133 // Make sure the image renderer gets created because we need the renderer 136 // Make sure the image renderer gets created because we need the renderer
134 // to read the aspect ratio. See crbug.com/320244 137 // to read the aspect ratio. See crbug.com/320244
135 document()->updateRenderTreeIfNeeded(); 138 document()->updateRenderTreeIfNeeded();
136 document()->imageUpdated(); 139 document()->imageUpdated();
137 } 140 }
138 141
139 void ImageDocumentParser::finish() 142 void ImageDocumentParser::finish()
140 { 143 {
141 if (!isStopped() && document()->imageElement() && document()->cachedImage()) { 144 if (!isStopped() && document()->imageElement() && document()->cachedImage()) {
142 ImageResource* cachedImage = document()->cachedImage(); 145 ImageResource* cachedImage = document()->cachedImage();
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 396 }
394 397
395 bool ImageEventListener::operator==(const EventListener& listener) 398 bool ImageEventListener::operator==(const EventListener& listener)
396 { 399 {
397 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 400 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
398 return m_doc == imageEventListener->m_doc; 401 return m_doc == imageEventListener->m_doc;
399 return false; 402 return false;
400 } 403 }
401 404
402 } 405 }
OLDNEW
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.cpp ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698