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

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

Issue 1890613002: Support createImageBitmap from a SVG image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/graphics/SVGImage.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 static float resolveWidthForRatio(float height, const FloatSize& intrinsicRatio) 161 static float resolveWidthForRatio(float height, const FloatSize& intrinsicRatio)
162 { 162 {
163 return height * intrinsicRatio.width() / intrinsicRatio.height(); 163 return height * intrinsicRatio.width() / intrinsicRatio.height();
164 } 164 }
165 165
166 static float resolveHeightForRatio(float width, const FloatSize& intrinsicRatio) 166 static float resolveHeightForRatio(float width, const FloatSize& intrinsicRatio)
167 { 167 {
168 return width * intrinsicRatio.height() / intrinsicRatio.width(); 168 return width * intrinsicRatio.height() / intrinsicRatio.width();
169 } 169 }
170 170
171 bool SVGImage::hasIntrinsicDimensions() const
172 {
173 return !concreteObjectSize(FloatSize()).isEmpty();
174 }
175
171 FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const 176 FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const
172 { 177 {
173 SVGSVGElement* svg = svgRootElement(m_page.get()); 178 SVGSVGElement* svg = svgRootElement(m_page.get());
174 if (!svg) 179 if (!svg)
175 return FloatSize(); 180 return FloatSize();
176 181
177 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(svg->layoutObject()); 182 LayoutSVGRoot* layoutObject = toLayoutSVGRoot(svg->layoutObject());
178 if (!layoutObject) 183 if (!layoutObject)
179 return FloatSize(); 184 return FloatSize();
180 185
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 542
538 return m_page; 543 return m_page;
539 } 544 }
540 545
541 String SVGImage::filenameExtension() const 546 String SVGImage::filenameExtension() const
542 { 547 {
543 return "svg"; 548 return "svg";
544 } 549 }
545 550
546 } // namespace blink 551 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/graphics/SVGImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698