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

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1694263003: Add Image::updateConcreteSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-size-calculation-in
Patch Set: Pull test for now, needs changes in upcoming CL to pass. Address nits. 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) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (intrinsicSizingInfo.hasHeight) { 203 if (intrinsicSizingInfo.hasHeight) {
204 if (intrinsicSizingInfo.aspectRatio.isEmpty()) 204 if (intrinsicSizingInfo.aspectRatio.isEmpty())
205 return FloatSize(defaultObjectSize.width(), intrinsicSizingInfo.size .height()); 205 return FloatSize(defaultObjectSize.width(), intrinsicSizingInfo.size .height());
206 206
207 return FloatSize(resolveWidthForRatio(intrinsicSizingInfo.size.height(), intrinsicSizingInfo.aspectRatio), intrinsicSizingInfo.size.height()); 207 return FloatSize(resolveWidthForRatio(intrinsicSizingInfo.size.height(), intrinsicSizingInfo.aspectRatio), intrinsicSizingInfo.size.height());
208 } 208 }
209 209
210 if (!intrinsicSizingInfo.aspectRatio.isEmpty()) { 210 if (!intrinsicSizingInfo.aspectRatio.isEmpty()) {
211 // TODO(davve): According to the specification, the concrete object size should resolve as a 211 // TODO(davve): According to the specification, the concrete object size should resolve as a
212 // contain constraint against the default object size at this stage. Unt il the 212 // contain constraint against the default object size at this stage. Unt il the
213 // defaultObjectSize is context sensitive, right now it's hard-coded to 300x150, we have to 213 // defaultObjectSize is context sensitive - right now it's hard-coded to 300x150 - we have
214 // preserve legacy behavior by returning the aspectRatio as the concrete object size. 214 // to preserve legacy behavior by returning the aspectRatio as the concr ete object size.
215 return intrinsicSizingInfo.aspectRatio; 215 return intrinsicSizingInfo.aspectRatio;
216 } 216 }
217 217
218 return defaultObjectSize; 218 return defaultObjectSize;
219 } 219 }
220 220
221 void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const Fl oatSize containerSize, float zoom, const FloatRect& dstRect, 221 void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const Fl oatSize containerSize, float zoom, const FloatRect& dstRect,
222 const FloatRect& srcRect, const KURL& url) 222 const FloatRect& srcRect, const KURL& url)
223 { 223 {
224 if (!m_page) 224 if (!m_page)
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 539 }
540 540
541 return m_page; 541 return m_page;
542 } 542 }
543 543
544 String SVGImage::filenameExtension() const 544 String SVGImage::filenameExtension() const
545 { 545 {
546 return "svg"; 546 return "svg";
547 } 547 }
548 548
549 void SVGImage::updateConcreteObjectSize(const LayoutSize& defaultObjectSize)
550 {
551 m_concreteObjectSize = roundedIntSize(calculateConcreteObjectSize(FloatSize( defaultObjectSize)));
552 }
553
549 } // namespace blink 554 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698