| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 #else | 254 #else |
| 255 UNUSED_PARAM(renderer); | 255 UNUSED_PARAM(renderer); |
| 256 #endif | 256 #endif |
| 257 | 257 |
| 258 if (multiplier == 1.0f) | 258 if (multiplier == 1.0f) |
| 259 return imageSize; | 259 return imageSize; |
| 260 | 260 |
| 261 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed
. | 261 // Don't let images that have a width/height >= 1 shrink below 1 when zoomed
. |
| 262 bool hasWidth = imageSize.width() > 0; | 262 float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier; |
| 263 bool hasHeight = imageSize.height() > 0; | 263 float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier; |
| 264 int width = imageSize.width() * (m_image->hasRelativeWidth() ? 1.0f : multip
lier); | 264 IntSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ?
1 : 0); |
| 265 int height = imageSize.height() * (m_image->hasRelativeHeight() ? 1.0f : mul
tiplier); | 265 imageSize.scale(widthScale, heightScale); |
| 266 if (hasWidth) | 266 imageSize.clampToMinimumSize(minimumSize); |
| 267 width = max(1, width); | 267 return imageSize; |
| 268 if (hasHeight) | |
| 269 height = max(1, height); | |
| 270 return IntSize(width, height); | |
| 271 } | 268 } |
| 272 | 269 |
| 273 void CachedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& int
rinsicHeight, FloatSize& intrinsicRatio, float scaleFactor) | 270 void CachedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& int
rinsicHeight, FloatSize& intrinsicRatio, float scaleFactor) |
| 274 { | 271 { |
| 275 if (m_image) | 272 if (m_image) |
| 276 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio, scaleFactor); | 273 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio, scaleFactor); |
| 277 } | 274 } |
| 278 | 275 |
| 279 void CachedImage::notifyObservers(const IntRect* changeRect) | 276 void CachedImage::notifyObservers(const IntRect* changeRect) |
| 280 { | 277 { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 // We have to update the cached ImageBuffers if the underlying content chang
ed. | 452 // We have to update the cached ImageBuffers if the underlying content chang
ed. |
| 456 if (image->isSVGImage()) { | 453 if (image->isSVGImage()) { |
| 457 m_svgImageCache->imageContentChanged(); | 454 m_svgImageCache->imageContentChanged(); |
| 458 return; | 455 return; |
| 459 } | 456 } |
| 460 #endif | 457 #endif |
| 461 notifyObservers(&rect); | 458 notifyObservers(&rect); |
| 462 } | 459 } |
| 463 | 460 |
| 464 } // namespace WebCore | 461 } // namespace WebCore |
| OLD | NEW |