OLD | NEW |
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 return LayoutSize(); | 213 return LayoutSize(); |
214 | 214 |
215 LayoutSize size; | 215 LayoutSize size; |
216 | 216 |
217 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag
eOrientation) | 217 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag
eOrientation) |
218 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio
n()); | 218 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio
n()); |
219 else | 219 else |
220 size = LayoutSize(m_image->size()); | 220 size = LayoutSize(m_image->size()); |
221 | 221 |
222 if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue
&& m_devicePixelRatioHeaderValue > 0) | 222 if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue
&& m_devicePixelRatioHeaderValue > 0) |
223 multiplier = 1.0 / m_devicePixelRatioHeaderValue; | 223 multiplier = 1 / m_devicePixelRatioHeaderValue; |
224 | 224 |
225 if (multiplier == 1.0f) | 225 if (multiplier == 1 || m_image->hasRelativeSize()) |
226 return size; | 226 return size; |
227 | 227 |
228 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed
. | 228 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed
. |
229 float widthScale = m_image->hasRelativeSize() ? 1.0f : multiplier; | |
230 float heightScale = m_image->hasRelativeSize() ? 1.0f : multiplier; | |
231 LayoutSize minimumSize(size.width() > LayoutUnit() ? LayoutUnit(1) : LayoutU
nit(), | 229 LayoutSize minimumSize(size.width() > LayoutUnit() ? LayoutUnit(1) : LayoutU
nit(), |
232 LayoutUnit(size.height() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit()))
; | 230 LayoutUnit(size.height() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit()))
; |
233 size.scale(widthScale, heightScale); | 231 size.scale(multiplier); |
234 size.clampToMinimumSize(minimumSize); | 232 size.clampToMinimumSize(minimumSize); |
235 ASSERT(multiplier != 1.0f || (size.width().fraction() == 0.0f && size.height
().fraction() == 0.0f)); | |
236 return size; | 233 return size; |
237 } | 234 } |
238 | 235 |
239 void ImageResource::computeIntrinsicDimensions(Length& intrinsicWidth, Length& i
ntrinsicHeight, FloatSize& intrinsicRatio) | 236 void ImageResource::computeIntrinsicDimensions(Length& intrinsicWidth, Length& i
ntrinsicHeight, FloatSize& intrinsicRatio) |
240 { | 237 { |
241 if (m_image) | 238 if (m_image) |
242 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio); | 239 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio); |
243 } | 240 } |
244 | 241 |
245 void ImageResource::notifyObservers(const IntRect* changeRect) | 242 void ImageResource::notifyObservers(const IntRect* changeRect) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return true; | 444 return true; |
448 return !securityOrigin->taintsCanvas(response().url()); | 445 return !securityOrigin->taintsCanvas(response().url()); |
449 } | 446 } |
450 | 447 |
451 bool ImageResource::loadingMultipartContent() const | 448 bool ImageResource::loadingMultipartContent() const |
452 { | 449 { |
453 return m_loader && m_loader->loadingMultipartContent(); | 450 return m_loader && m_loader->loadingMultipartContent(); |
454 } | 451 } |
455 | 452 |
456 } // namespace blink | 453 } // namespace blink |
OLD | NEW |