| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "core/inspector/InspectorTraceEvents.h" | 42 #include "core/inspector/InspectorTraceEvents.h" |
| 43 #include "core/rendering/HitTestResult.h" | 43 #include "core/rendering/HitTestResult.h" |
| 44 #include "core/rendering/PaintInfo.h" | 44 #include "core/rendering/PaintInfo.h" |
| 45 #include "core/rendering/RenderView.h" | 45 #include "core/rendering/RenderView.h" |
| 46 #include "core/svg/graphics/SVGImage.h" | 46 #include "core/svg/graphics/SVGImage.h" |
| 47 #include "platform/fonts/Font.h" | 47 #include "platform/fonts/Font.h" |
| 48 #include "platform/fonts/FontCache.h" | 48 #include "platform/fonts/FontCache.h" |
| 49 #include "platform/graphics/GraphicsContext.h" | 49 #include "platform/graphics/GraphicsContext.h" |
| 50 #include "platform/graphics/GraphicsContextStateSaver.h" | 50 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 51 | 51 |
| 52 using namespace std; | |
| 53 | |
| 54 namespace WebCore { | 52 namespace WebCore { |
| 55 | 53 |
| 56 using namespace HTMLNames; | 54 using namespace HTMLNames; |
| 57 | 55 |
| 58 RenderImage::RenderImage(Element* element) | 56 RenderImage::RenderImage(Element* element) |
| 59 : RenderReplaced(element, IntSize()) | 57 : RenderReplaced(element, IntSize()) |
| 60 , m_didIncrementVisuallyNonEmptyPixelCount(false) | 58 , m_didIncrementVisuallyNonEmptyPixelCount(false) |
| 61 , m_isGeneratedContent(false) | 59 , m_isGeneratedContent(false) |
| 62 , m_imageDevicePixelRatio(1.0f) | 60 , m_imageDevicePixelRatio(1.0f) |
| 63 { | 61 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 else if (!m_altText.isEmpty() || newImage) { | 121 else if (!m_altText.isEmpty() || newImage) { |
| 124 // If we'll be displaying either text or an image, add a little padding. | 122 // If we'll be displaying either text or an image, add a little padding. |
| 125 imageSize = IntSize(paddingWidth, paddingHeight); | 123 imageSize = IntSize(paddingWidth, paddingHeight); |
| 126 } | 124 } |
| 127 | 125 |
| 128 // we have an alt and the user meant it (its not a text we invented) | 126 // we have an alt and the user meant it (its not a text we invented) |
| 129 if (!m_altText.isEmpty()) { | 127 if (!m_altText.isEmpty()) { |
| 130 FontCachePurgePreventer fontCachePurgePreventer; | 128 FontCachePurgePreventer fontCachePurgePreventer; |
| 131 | 129 |
| 132 const Font& font = style()->font(); | 130 const Font& font = style()->font(); |
| 133 IntSize paddedTextSize(paddingWidth + min(ceilf(font.width(RenderBlockFl
ow::constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), paddin
gHeight + min(font.fontMetrics().height(), maxAltTextHeight)); | 131 IntSize paddedTextSize(paddingWidth + std::min(ceilf(font.width(RenderBl
ockFlow::constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), p
addingHeight + std::min(font.fontMetrics().height(), maxAltTextHeight)); |
| 134 imageSize = imageSize.expandedTo(paddedTextSize); | 132 imageSize = imageSize.expandedTo(paddedTextSize); |
| 135 } | 133 } |
| 136 | 134 |
| 137 if (imageSize == intrinsicSize()) | 135 if (imageSize == intrinsicSize()) |
| 138 return false; | 136 return false; |
| 139 | 137 |
| 140 setIntrinsicSize(imageSize); | 138 setIntrinsicSize(imageSize); |
| 141 return true; | 139 return true; |
| 142 } | 140 } |
| 143 | 141 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 return 0; | 620 return 0; |
| 623 | 621 |
| 624 ImageResource* cachedImage = m_imageResource->cachedImage(); | 622 ImageResource* cachedImage = m_imageResource->cachedImage(); |
| 625 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) | 623 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) |
| 626 return toSVGImage(cachedImage->image())->embeddedContentBox(); | 624 return toSVGImage(cachedImage->image())->embeddedContentBox(); |
| 627 | 625 |
| 628 return 0; | 626 return 0; |
| 629 } | 627 } |
| 630 | 628 |
| 631 } // namespace WebCore | 629 } // namespace WebCore |
| OLD | NEW |