| OLD | NEW |
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return IntSize(); | 155 return IntSize(); |
| 156 | 156 |
| 157 // If a container size is available it has precedence. | 157 // If a container size is available it has precedence. |
| 158 IntSize containerSize = renderer->containerSize(); | 158 IntSize containerSize = renderer->containerSize(); |
| 159 if (!containerSize.isEmpty()) | 159 if (!containerSize.isEmpty()) |
| 160 return containerSize; | 160 return containerSize; |
| 161 | 161 |
| 162 // Assure that a container size is always given for a non-identity zoom leve
l. | 162 // Assure that a container size is always given for a non-identity zoom leve
l. |
| 163 ASSERT(renderer->style()->effectiveZoom() == 1); | 163 ASSERT(renderer->style()->effectiveZoom() == 1); |
| 164 | 164 |
| 165 FloatSize currentSize; | 165 FloatSize intrinsicSize; |
| 166 if (rootElement->hasIntrinsicWidth() && rootElement->hasIntrinsicHeight()) | 166 double intrinsicRatio = 0; |
| 167 currentSize = rootElement->currentViewportSize(); | 167 renderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); |
| 168 else | |
| 169 currentSize = rootElement->currentViewBoxRect().size(); | |
| 170 | 168 |
| 171 if (!currentSize.isEmpty()) | 169 if (intrinsicSize.isEmpty() && intrinsicRatio) { |
| 172 return IntSize(static_cast<int>(ceilf(currentSize.width())), static_cast
<int>(ceilf(currentSize.height()))); | 170 if (!intrinsicSize.width() && intrinsicSize.height()) |
| 171 intrinsicSize.setWidth(intrinsicSize.height() * intrinsicRatio); |
| 172 else if (intrinsicSize.width() && !intrinsicSize.height()) |
| 173 intrinsicSize.setHeight(intrinsicSize.width() / intrinsicRatio); |
| 174 } |
| 173 | 175 |
| 174 // As last resort, use CSS default intrinsic size. | 176 if (!intrinsicSize.isEmpty()) |
| 177 return expandedIntSize(intrinsicSize); |
| 178 |
| 179 // As last resort, use CSS replaced element fallback size. |
| 175 return IntSize(300, 150); | 180 return IntSize(300, 150); |
| 176 } | 181 } |
| 177 | 182 |
| 178 void SVGImage::drawForContainer(GraphicsContext* context, const FloatSize contai
nerSize, float zoom, const FloatRect& dstRect, | 183 void SVGImage::drawForContainer(GraphicsContext* context, const FloatSize contai
nerSize, float zoom, const FloatRect& dstRect, |
| 179 const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode
blendMode) | 184 const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode
blendMode) |
| 180 { | 185 { |
| 181 if (!m_page) | 186 if (!m_page) |
| 182 return; | 187 return; |
| 183 | 188 |
| 184 // Temporarily disable the image observer to prevent changeInRect() calls du
e re-laying out the image. | 189 // Temporarily disable the image observer to prevent changeInRect() calls du
e re-laying out the image. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 422 |
| 418 return m_page; | 423 return m_page; |
| 419 } | 424 } |
| 420 | 425 |
| 421 String SVGImage::filenameExtension() const | 426 String SVGImage::filenameExtension() const |
| 422 { | 427 { |
| 423 return "svg"; | 428 return "svg"; |
| 424 } | 429 } |
| 425 | 430 |
| 426 } | 431 } |
| OLD | NEW |