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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 | 209 |
210 bool ImageResource::imageHasRelativeHeight() const | 210 bool ImageResource::imageHasRelativeHeight() const |
211 { | 211 { |
212 if (m_image) | 212 if (m_image) |
213 return m_image->hasRelativeHeight(); | 213 return m_image->hasRelativeHeight(); |
214 | 214 |
215 return false; | 215 return false; |
216 } | 216 } |
217 | 217 |
218 LayoutSize ImageResource::imageSizeForLayoutObject(const LayoutObject* layoutObj
ect, float multiplier, SizeType sizeType) | 218 LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma
geOrientation, float multiplier, SizeType sizeType) |
219 { | 219 { |
220 ASSERT(!isPurgeable()); | 220 ASSERT(!isPurgeable()); |
221 | 221 |
222 if (!m_image) | 222 if (!m_image) |
223 return LayoutSize(); | 223 return LayoutSize(); |
224 | 224 |
225 LayoutSize imageSize; | 225 LayoutSize size; |
226 | 226 |
227 if (m_image->isBitmapImage() && (layoutObject && layoutObject->shouldRespect
ImageOrientation() == RespectImageOrientation)) | 227 if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImag
eOrientation) |
228 imageSize = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrien
tation()); | 228 size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientatio
n()); |
229 else | 229 else |
230 imageSize = LayoutSize(m_image->size()); | 230 size = LayoutSize(m_image->size()); |
231 | 231 |
232 if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue
&& m_devicePixelRatioHeaderValue > 0) | 232 if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue
&& m_devicePixelRatioHeaderValue > 0) |
233 multiplier = 1.0 / m_devicePixelRatioHeaderValue; | 233 multiplier = 1.0 / m_devicePixelRatioHeaderValue; |
234 | 234 |
235 if (multiplier == 1.0f) | 235 if (multiplier == 1.0f) |
236 return imageSize; | 236 return size; |
237 | 237 |
238 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed
. | 238 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed
. |
239 float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier; | 239 float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier; |
240 float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier; | 240 float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier; |
241 LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0
? 1 : 0); | 241 LayoutSize minimumSize(size.width() > 0 ? 1 : 0, size.height() > 0 ? 1 : 0); |
242 imageSize.scale(widthScale, heightScale); | 242 size.scale(widthScale, heightScale); |
243 imageSize.clampToMinimumSize(minimumSize); | 243 size.clampToMinimumSize(minimumSize); |
244 ASSERT(multiplier != 1.0f || (imageSize.width().fraction() == 0.0f && imageS
ize.height().fraction() == 0.0f)); | 244 ASSERT(multiplier != 1.0f || (size.width().fraction() == 0.0f && size.height
().fraction() == 0.0f)); |
245 return imageSize; | 245 return size; |
246 } | 246 } |
247 | 247 |
248 void ImageResource::computeIntrinsicDimensions(Length& intrinsicWidth, Length& i
ntrinsicHeight, FloatSize& intrinsicRatio) | 248 void ImageResource::computeIntrinsicDimensions(Length& intrinsicWidth, Length& i
ntrinsicHeight, FloatSize& intrinsicRatio) |
249 { | 249 { |
250 if (m_image) | 250 if (m_image) |
251 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio); | 251 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio); |
252 } | 252 } |
253 | 253 |
254 void ImageResource::notifyObservers(const IntRect* changeRect) | 254 void ImageResource::notifyObservers(const IntRect* changeRect) |
255 { | 255 { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 return true; | 468 return true; |
469 return !securityOrigin->taintsCanvas(response().url()); | 469 return !securityOrigin->taintsCanvas(response().url()); |
470 } | 470 } |
471 | 471 |
472 bool ImageResource::loadingMultipartContent() const | 472 bool ImageResource::loadingMultipartContent() const |
473 { | 473 { |
474 return m_loader && m_loader->loadingMultipartContent(); | 474 return m_loader && m_loader->loadingMultipartContent(); |
475 } | 475 } |
476 | 476 |
477 } // namespace blink | 477 } // namespace blink |
OLD | NEW |