| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 IntSize containerSize = layoutObject->containerSize(); | 149 IntSize containerSize = layoutObject->containerSize(); |
| 150 if (!containerSize.isEmpty()) | 150 if (!containerSize.isEmpty()) |
| 151 return containerSize; | 151 return containerSize; |
| 152 | 152 |
| 153 // Assure that a container size is always given for a non-identity zoom leve
l. | 153 // Assure that a container size is always given for a non-identity zoom leve
l. |
| 154 ASSERT(layoutObject->style()->effectiveZoom() == 1); | 154 ASSERT(layoutObject->style()->effectiveZoom() == 1); |
| 155 | 155 |
| 156 LayoutBox::IntrinsicSizingInfo intrinsicSizingInfo; | 156 LayoutBox::IntrinsicSizingInfo intrinsicSizingInfo; |
| 157 layoutObject->computeIntrinsicSizingInfo(intrinsicSizingInfo); | 157 layoutObject->computeIntrinsicSizingInfo(intrinsicSizingInfo); |
| 158 | 158 |
| 159 if (intrinsicSizingInfo.size.isEmpty() && intrinsicSizingInfo.aspectRatio) { | 159 if (intrinsicSizingInfo.size.isEmpty() && !intrinsicSizingInfo.aspectRatio.i
sEmpty()) { |
| 160 if (!intrinsicSizingInfo.size.width() && intrinsicSizingInfo.size.height
()) | 160 if (!intrinsicSizingInfo.size.width() && intrinsicSizingInfo.size.height
()) { |
| 161 intrinsicSizingInfo.size.setWidth(intrinsicSizingInfo.size.height()
* intrinsicSizingInfo.aspectRatio); | 161 intrinsicSizingInfo.size.setWidth( |
| 162 else if (intrinsicSizingInfo.size.width() && !intrinsicSizingInfo.size.h
eight()) | 162 intrinsicSizingInfo.size.height() * intrinsicSizingInfo.aspectRa
tio.width() / intrinsicSizingInfo.aspectRatio.height()); |
| 163 intrinsicSizingInfo.size.setHeight(intrinsicSizingInfo.size.width()
/ intrinsicSizingInfo.aspectRatio); | 163 } else if (intrinsicSizingInfo.size.width() && !intrinsicSizingInfo.size
.height()) { |
| 164 intrinsicSizingInfo.size.setHeight( |
| 165 intrinsicSizingInfo.size.width() * intrinsicSizingInfo.aspectRat
io.height() / intrinsicSizingInfo.aspectRatio.width()); |
| 166 } |
| 164 } | 167 } |
| 165 | 168 |
| 166 // TODO(davve): In order to maintain aspect ratio the intrinsic | 169 // TODO(davve): In order to maintain aspect ratio the intrinsic |
| 167 // size is faked from the viewBox as a last resort. This may cause | 170 // size is faked from the viewBox as a last resort. This may cause |
| 168 // unwanted side effects. Preferably we should be able to signal | 171 // unwanted side effects. Preferably we should be able to signal |
| 169 // the intrinsic ratio in another way. | 172 // the intrinsic ratio in another way. |
| 170 if (intrinsicSizingInfo.size.isEmpty()) | 173 if (intrinsicSizingInfo.size.isEmpty()) |
| 171 intrinsicSizingInfo.size = rootElement->currentViewBoxRect().size(); | 174 intrinsicSizingInfo.size = rootElement->currentViewBoxRect().size(); |
| 172 | 175 |
| 173 if (!intrinsicSizingInfo.size.isEmpty()) | 176 if (!intrinsicSizingInfo.size.isEmpty()) |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 503 |
| 501 return m_page; | 504 return m_page; |
| 502 } | 505 } |
| 503 | 506 |
| 504 String SVGImage::filenameExtension() const | 507 String SVGImage::filenameExtension() const |
| 505 { | 508 { |
| 506 return "svg"; | 509 return "svg"; |
| 507 } | 510 } |
| 508 | 511 |
| 509 } // namespace blink | 512 } // namespace blink |
| OLD | NEW |