| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 10 * | 10 * |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 LayoutObject* containingBlock = isOutOfFlowPositioned() ? container() :
this->containingBlock(); | 293 LayoutObject* containingBlock = isOutOfFlowPositioned() ? container() :
this->containingBlock(); |
| 294 if (containingBlock->isBox()) { | 294 if (containingBlock->isBox()) { |
| 295 LayoutBox* box = toLayoutBox(containingBlock); | 295 LayoutBox* box = toLayoutBox(containingBlock); |
| 296 intrinsicSizingInfo.size.setWidth(box->availableLogicalWidth().toFlo
at()); | 296 intrinsicSizingInfo.size.setWidth(box->availableLogicalWidth().toFlo
at()); |
| 297 intrinsicSizingInfo.size.setHeight(box->availableLogicalHeight(Inclu
deMarginBorderPadding).toFloat()); | 297 intrinsicSizingInfo.size.setHeight(box->availableLogicalHeight(Inclu
deMarginBorderPadding).toFloat()); |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 // Don't compute an intrinsic ratio to preserve historical WebKit behavior i
f we're painting alt text and/or a broken image. | 300 // Don't compute an intrinsic ratio to preserve historical WebKit behavior i
f we're painting alt text and/or a broken image. |
| 301 // Video is excluded from this behavior because video elements have a defaul
t aspect ratio that a failed poster image load should not override. | 301 // Video is excluded from this behavior because video elements have a defaul
t aspect ratio that a failed poster image load should not override. |
| 302 if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) { | 302 if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) { |
| 303 intrinsicSizingInfo.aspectRatio = 1; | 303 intrinsicSizingInfo.aspectRatio = FloatSize(1, 1); |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool LayoutImage::needsPreferredWidthsRecalculation() const | 308 bool LayoutImage::needsPreferredWidthsRecalculation() const |
| 309 { | 309 { |
| 310 if (LayoutReplaced::needsPreferredWidthsRecalculation()) | 310 if (LayoutReplaced::needsPreferredWidthsRecalculation()) |
| 311 return true; | 311 return true; |
| 312 return embeddedContentBox(); | 312 return embeddedContentBox(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 LayoutBox* LayoutImage::embeddedContentBox() const | 315 LayoutBox* LayoutImage::embeddedContentBox() const |
| 316 { | 316 { |
| 317 if (!m_imageResource) | 317 if (!m_imageResource) |
| 318 return nullptr; | 318 return nullptr; |
| 319 | 319 |
| 320 ImageResource* cachedImage = m_imageResource->cachedImage(); | 320 ImageResource* cachedImage = m_imageResource->cachedImage(); |
| 321 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) | 321 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) |
| 322 return toSVGImage(cachedImage->image())->embeddedContentBox(); | 322 return toSVGImage(cachedImage->image())->embeddedContentBox(); |
| 323 | 323 |
| 324 return nullptr; | 324 return nullptr; |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace blink | 327 } // namespace blink |
| OLD | NEW |