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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 bool ImageResource::imageHasRelativeSize() const 206 bool ImageResource::imageHasRelativeSize() const
207 { 207 {
208 if (m_image) 208 if (m_image)
209 return m_image->hasRelativeSize(); 209 return m_image->hasRelativeSize();
210 210
211 return false; 211 return false;
212 } 212 }
213 213
214 LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma geOrientation, float multiplier, SizeType sizeType) 214 LayoutSize ImageResource::concreteObjectSize(const FloatSize& defaultObjectSize, RespectImageOrientationEnum shouldRespectImageOrientation, float multiplier, Si zeType sizeType)
215 { 215 {
216 ASSERT(!isPurgeable()); 216 ASSERT(!isPurgeable());
217 217
218 if (!m_image) 218 if (!m_image)
219 return LayoutSize(); 219 return LayoutSize();
220 220
221 LayoutSize size; 221 LayoutSize size;
222 222
223 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag eOrientation) 223 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag eOrientation)
224 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio n()); 224 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio n());
225 else 225 else
226 size = LayoutSize(m_image->size()); 226 size = LayoutSize(m_image->concreteObjectSize(defaultObjectSize));
227 227
228 if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue && m_devicePixelRatioHeaderValue > 0) 228 if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue && m_devicePixelRatioHeaderValue > 0)
229 multiplier = 1 / m_devicePixelRatioHeaderValue; 229 multiplier = 1 / m_devicePixelRatioHeaderValue;
230 230
231 if (multiplier == 1 || m_image->hasRelativeSize()) 231 if (multiplier == 1 || m_image->hasRelativeSize())
232 return size; 232 return size;
233 233
234 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed . 234 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed .
235 LayoutSize minimumSize(size.width() > LayoutUnit() ? LayoutUnit(1) : LayoutU nit(), 235 LayoutSize minimumSize(size.width() > LayoutUnit() ? LayoutUnit(1) : LayoutU nit(),
236 LayoutUnit(size.height() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit())) ; 236 LayoutUnit(size.height() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit())) ;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 return true; 464 return true;
465 return !securityOrigin->taintsCanvas(response().url()); 465 return !securityOrigin->taintsCanvas(response().url());
466 } 466 }
467 467
468 bool ImageResource::loadingMultipartContent() const 468 bool ImageResource::loadingMultipartContent() const
469 { 469 {
470 return m_loader && m_loader->loadingMultipartContent(); 470 return m_loader && m_loader->loadingMultipartContent();
471 } 471 }
472 472
473 } // namespace blink 473 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/frame/ImageBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698