| 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) 2006 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 class HTMLMapElement; | 34 class HTMLMapElement; |
| 35 | 35 |
| 36 class RenderImage : public RenderReplaced { | 36 class RenderImage : public RenderReplaced { |
| 37 public: | 37 public: |
| 38 // These are the paddings to use when displaying either alt text or an image
. | 38 // These are the paddings to use when displaying either alt text or an image
. |
| 39 static const unsigned short paddingWidth = 4; | 39 static const unsigned short paddingWidth = 4; |
| 40 static const unsigned short paddingHeight = 4; | 40 static const unsigned short paddingHeight = 4; |
| 41 | 41 |
| 42 RenderImage(Element*); | 42 RenderImage(Element*); |
| 43 virtual ~RenderImage(); | 43 virtual ~RenderImage(); |
| 44 virtual void destroy() OVERRIDE; | 44 virtual void destroy() override; |
| 45 | 45 |
| 46 static RenderImage* createAnonymous(Document*); | 46 static RenderImage* createAnonymous(Document*); |
| 47 | 47 |
| 48 void setImageResource(PassOwnPtr<RenderImageResource>); | 48 void setImageResource(PassOwnPtr<RenderImageResource>); |
| 49 | 49 |
| 50 RenderImageResource* imageResource() { return m_imageResource.get(); } | 50 RenderImageResource* imageResource() { return m_imageResource.get(); } |
| 51 const RenderImageResource* imageResource() const { return m_imageResource.ge
t(); } | 51 const RenderImageResource* imageResource() const { return m_imageResource.ge
t(); } |
| 52 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc
e->cachedImage() : 0; } | 52 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc
e->cachedImage() : 0; } |
| 53 | 53 |
| 54 bool setImageSizeForAltText(ImageResource* newImage = 0); | 54 bool setImageSizeForAltText(ImageResource* newImage = 0); |
| 55 | 55 |
| 56 void updateAltText(); | 56 void updateAltText(); |
| 57 | 57 |
| 58 HTMLMapElement* imageMap() const; | 58 HTMLMapElement* imageMap() const; |
| 59 void areaElementFocusChanged(HTMLAreaElement*); | 59 void areaElementFocusChanged(HTMLAreaElement*); |
| 60 | 60 |
| 61 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g
enerated; } | 61 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g
enerated; } |
| 62 | 62 |
| 63 bool isGeneratedContent() const { return m_isGeneratedContent; } | 63 bool isGeneratedContent() const { return m_isGeneratedContent; } |
| 64 | 64 |
| 65 String altText() const { return m_altText; } | 65 String altText() const { return m_altText; } |
| 66 | 66 |
| 67 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } | 67 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } |
| 68 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } | 68 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } |
| 69 | 69 |
| 70 virtual void intrinsicSizeChanged() OVERRIDE | 70 virtual void intrinsicSizeChanged() override |
| 71 { | 71 { |
| 72 if (m_imageResource) | 72 if (m_imageResource) |
| 73 imageChanged(m_imageResource->imagePtr()); | 73 imageChanged(m_imageResource->imagePtr()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 protected: | 76 protected: |
| 77 virtual bool needsPreferredWidthsRecalculation() const OVERRIDE FINAL; | 77 virtual bool needsPreferredWidthsRecalculation() const override final; |
| 78 virtual RenderBox* embeddedContentBox() const OVERRIDE FINAL; | 78 virtual RenderBox* embeddedContentBox() const override final; |
| 79 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const OVERRIDE FINAL; | 79 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override final; |
| 80 | 80 |
| 81 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; | 81 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override; |
| 82 | 82 |
| 83 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL; | 83 virtual void paint(PaintInfo&, const LayoutPoint&) override final; |
| 84 virtual void layout() OVERRIDE; | 84 virtual void layout() override; |
| 85 virtual bool updateImageLoadingPriorities() OVERRIDE FINAL; | 85 virtual bool updateImageLoadingPriorities() override final; |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 virtual const char* renderName() const OVERRIDE { return "RenderImage"; } | 88 virtual const char* renderName() const override { return "RenderImage"; } |
| 89 | 89 |
| 90 virtual bool isImage() const OVERRIDE { return true; } | 90 virtual bool isImage() const override { return true; } |
| 91 virtual bool isRenderImage() const OVERRIDE FINAL { return true; } | 91 virtual bool isRenderImage() const override final { return true; } |
| 92 | 92 |
| 93 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) OVERRIDE; | 93 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) override; |
| 94 | 94 |
| 95 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const OVERRIDE FINAL; | 95 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const override final; |
| 96 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE FINAL; | 96 virtual bool computeBackgroundIsKnownToBeObscured() override final; |
| 97 | 97 |
| 98 virtual LayoutUnit minimumReplacedHeight() const OVERRIDE; | 98 virtual LayoutUnit minimumReplacedHeight() const override; |
| 99 | 99 |
| 100 virtual void notifyFinished(Resource*) OVERRIDE FINAL; | 100 virtual void notifyFinished(Resource*) override final; |
| 101 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) OVERRIDE FINAL; | 101 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; |
| 102 | 102 |
| 103 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const OVERRIDE FINAL; | 103 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override final; |
| 104 | 104 |
| 105 IntSize imageSizeForError(ImageResource*) const; | 105 IntSize imageSizeForError(ImageResource*) const; |
| 106 void paintInvalidationOrMarkForLayout(bool imageSizeChanged, const IntRect*
= 0); | 106 void paintInvalidationOrMarkForLayout(bool imageSizeChanged, const IntRect*
= 0); |
| 107 void updateIntrinsicSizeIfNeeded(const LayoutSize&); | 107 void updateIntrinsicSizeIfNeeded(const LayoutSize&); |
| 108 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. | 108 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. |
| 109 void updateInnerContentRect(); | 109 void updateInnerContentRect(); |
| 110 | 110 |
| 111 // Text to display as long as the image isn't available. | 111 // Text to display as long as the image isn't available. |
| 112 String m_altText; | 112 String m_altText; |
| 113 OwnPtr<RenderImageResource> m_imageResource; | 113 OwnPtr<RenderImageResource> m_imageResource; |
| 114 bool m_didIncrementVisuallyNonEmptyPixelCount; | 114 bool m_didIncrementVisuallyNonEmptyPixelCount; |
| 115 bool m_isGeneratedContent; | 115 bool m_isGeneratedContent; |
| 116 float m_imageDevicePixelRatio; | 116 float m_imageDevicePixelRatio; |
| 117 | 117 |
| 118 friend class RenderImageScaleObserver; | 118 friend class RenderImageScaleObserver; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); | 121 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| 124 | 124 |
| 125 #endif // RenderImage_h | 125 #endif // RenderImage_h |
| OLD | NEW |