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

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

Issue 1928823002: Simplifying finishing a load on Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 | « third_party/WebKit/Source/core/fetch/ResourceTest.cpp ('k') | no next file » | 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (!isDetached()) 150 if (!isDetached())
151 document()->imageUpdated(); 151 document()->imageUpdated();
152 } 152 }
153 153
154 void ImageDocumentParser::finish() 154 void ImageDocumentParser::finish()
155 { 155 {
156 if (!isStopped() && document()->imageElement() && document()->cachedImage()) { 156 if (!isStopped() && document()->imageElement() && document()->cachedImage()) {
157 ImageResource* cachedImage = document()->cachedImage(); 157 ImageResource* cachedImage = document()->cachedImage();
158 DocumentLoader* loader = document()->loader(); 158 DocumentLoader* loader = document()->loader();
159 cachedImage->setResponse(loader->response()); 159 cachedImage->setResponse(loader->response());
160 cachedImage->setLoadFinishTime(loader->timing().responseEnd()); 160 cachedImage->finish(loader->timing().responseEnd());
161 cachedImage->finish();
162 161
163 // Report the natural image size in the page title, regardless of zoom l evel. 162 // Report the natural image size in the page title, regardless of zoom l evel.
164 // At a zoom level of 1 the image is guaranteed to have an integer size. 163 // At a zoom level of 1 the image is guaranteed to have an integer size.
165 IntSize size = flooredIntSize(cachedImage->imageSize(LayoutObject::shoul dRespectImageOrientation(document()->imageElement()->layoutObject()), 1.0f)); 164 IntSize size = flooredIntSize(cachedImage->imageSize(LayoutObject::shoul dRespectImageOrientation(document()->imageElement()->layoutObject()), 1.0f));
166 if (size.width()) { 165 if (size.width()) {
167 // Compute the title, we use the decoded filename of the resource, f alling 166 // Compute the title, we use the decoded filename of the resource, f alling
168 // back on the (decoded) hostname if there is no path. 167 // back on the (decoded) hostname if there is no path.
169 String fileName = decodeURLEscapeSequences(document()->url().lastPat hComponent()); 168 String fileName = decodeURLEscapeSequences(document()->url().lastPat hComponent());
170 if (fileName.isEmpty()) 169 if (fileName.isEmpty())
171 fileName = document()->url().host(); 170 fileName = document()->url().host();
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 442 }
444 443
445 bool ImageEventListener::operator==(const EventListener& listener) const 444 bool ImageEventListener::operator==(const EventListener& listener) const
446 { 445 {
447 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 446 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
448 return m_doc == imageEventListener->m_doc; 447 return m_doc == imageEventListener->m_doc;
449 return false; 448 return false;
450 } 449 }
451 450
452 } // namespace blink 451 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698