| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 using namespace HTMLNames; | 54 using namespace HTMLNames; |
| 55 | 55 |
| 56 RenderImage::RenderImage(Element* element) | 56 RenderImage::RenderImage(Element* element) |
| 57 : RenderReplaced(element, LayoutSize()) | 57 : RenderReplaced(element, LayoutSize()) |
| 58 , m_didIncrementVisuallyNonEmptyPixelCount(false) | 58 , m_didIncrementVisuallyNonEmptyPixelCount(false) |
| 59 , m_isGeneratedContent(false) | 59 , m_isGeneratedContent(false) |
| 60 , m_imageDevicePixelRatio(1.0f) | 60 , m_imageDevicePixelRatio(1.0f) |
| 61 { | 61 { |
| 62 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addRenderObj
ect(this); | 62 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addLayoutObj
ect(this); |
| 63 } | 63 } |
| 64 | 64 |
| 65 RenderImage* RenderImage::createAnonymous(Document* document) | 65 RenderImage* RenderImage::createAnonymous(Document* document) |
| 66 { | 66 { |
| 67 RenderImage* image = new RenderImage(0); | 67 RenderImage* image = new RenderImage(0); |
| 68 image->setDocumentForAnonymous(document); | 68 image->setDocumentForAnonymous(document); |
| 69 return image; | 69 return image; |
| 70 } | 70 } |
| 71 | 71 |
| 72 RenderImage::~RenderImage() | 72 RenderImage::~RenderImage() |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 return true; | 354 return true; |
| 355 } | 355 } |
| 356 | 356 |
| 357 void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, dou
ble& intrinsicRatio) const | 357 void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, dou
ble& intrinsicRatio) const |
| 358 { | 358 { |
| 359 RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRat
io); | 359 RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRat
io); |
| 360 | 360 |
| 361 // Our intrinsicSize is empty if we're rendering generated images with relat
ive width/height. Figure out the right intrinsic size to use. | 361 // Our intrinsicSize is empty if we're rendering generated images with relat
ive width/height. Figure out the right intrinsic size to use. |
| 362 if (intrinsicSize.isEmpty() && (m_imageResource->imageHasRelativeWidth() ||
m_imageResource->imageHasRelativeHeight())) { | 362 if (intrinsicSize.isEmpty() && (m_imageResource->imageHasRelativeWidth() ||
m_imageResource->imageHasRelativeHeight())) { |
| 363 RenderObject* containingBlock = isOutOfFlowPositioned() ? container() :
this->containingBlock(); | 363 LayoutObject* containingBlock = isOutOfFlowPositioned() ? container() :
this->containingBlock(); |
| 364 if (containingBlock->isBox()) { | 364 if (containingBlock->isBox()) { |
| 365 RenderBox* box = toRenderBox(containingBlock); | 365 RenderBox* box = toRenderBox(containingBlock); |
| 366 intrinsicSize.setWidth(box->availableLogicalWidth().toFloat()); | 366 intrinsicSize.setWidth(box->availableLogicalWidth().toFloat()); |
| 367 intrinsicSize.setHeight(box->availableLogicalHeight(IncludeMarginBor
derPadding).toFloat()); | 367 intrinsicSize.setHeight(box->availableLogicalHeight(IncludeMarginBor
derPadding).toFloat()); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 // Don't compute an intrinsic ratio to preserve historical WebKit behavior i
f we're painting alt text and/or a broken image. | 370 // Don't compute an intrinsic ratio to preserve historical WebKit behavior i
f we're painting alt text and/or a broken image. |
| 371 // Video is excluded from this behavior because video elements have a defaul
t aspect ratio that a failed poster image load should not override. | 371 // Video is excluded from this behavior because video elements have a defaul
t aspect ratio that a failed poster image load should not override. |
| 372 if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) { | 372 if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) { |
| 373 intrinsicRatio = 1; | 373 intrinsicRatio = 1; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 388 return 0; | 388 return 0; |
| 389 | 389 |
| 390 ImageResource* cachedImage = m_imageResource->cachedImage(); | 390 ImageResource* cachedImage = m_imageResource->cachedImage(); |
| 391 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) | 391 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) |
| 392 return toSVGImage(cachedImage->image())->embeddedContentBox(); | 392 return toSVGImage(cachedImage->image())->embeddedContentBox(); |
| 393 | 393 |
| 394 return 0; | 394 return 0; |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace blink | 397 } // namespace blink |
| OLD | NEW |