Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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.h> | |
| 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 Loading... | |
| 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 ASSERT(length <= UINT_MAX); | |
|
kouhei (in TOK)
2014/09/30 07:23:03
Can we have more reasonable limit for this?
kouhei (in TOK)
2014/09/30 07:41:22
RELEASE_ASSERT(length <= std::numeric_limits<unsig
tyoshino (SeeGerritForStatus)
2014/09/30 08:14:28
Done.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |