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

Side by Side Diff: Source/WebCore/loader/cache/CachedImage.cpp

Issue 10379031: Merge 114095 - Background width (or height) is wrong if width (or height) * zoom < 1. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/zoom-background-repeat-y-expected.html ('k') | Source/WebCore/platform/graphics/IntSize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698