| 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 12 matching lines...) Expand all Loading... |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef RenderImage_h | 25 #ifndef RenderImage_h |
| 26 #define RenderImage_h | 26 #define RenderImage_h |
| 27 | 27 |
| 28 #include "core/rendering/RenderImageResource.h" | 28 #include "core/rendering/RenderImageResource.h" |
| 29 #include "core/rendering/RenderReplaced.h" | 29 #include "core/rendering/RenderReplaced.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 class RenderImage : public RenderReplaced { | 33 class RenderImage final : public RenderReplaced { |
| 34 public: | 34 public: |
| 35 RenderImage(Element*); | 35 RenderImage(Element*); |
| 36 virtual ~RenderImage(); | 36 virtual ~RenderImage(); |
| 37 virtual void destroy() override; | 37 virtual void destroy() override; |
| 38 | 38 |
| 39 static RenderImage* createAnonymous(Document*); | 39 static RenderImage* createAnonymous(Document*); |
| 40 | 40 |
| 41 void setImageResource(PassOwnPtr<RenderImageResource>); | 41 void setImageResource(PassOwnPtr<RenderImageResource>); |
| 42 | 42 |
| 43 RenderImageResource* imageResource() { return m_imageResource.get(); } | 43 RenderImageResource* imageResource() { return m_imageResource.get(); } |
| 44 const RenderImageResource* imageResource() const { return m_imageResource.ge
t(); } | 44 const RenderImageResource* imageResource() const { return m_imageResource.ge
t(); } |
| 45 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc
e->cachedImage() : 0; } | 45 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc
e->cachedImage() : 0; } |
| 46 | 46 |
| 47 void highQualityRepaintTimerFired(Timer<RenderImage>*); | 47 void highQualityRepaintTimerFired(Timer<RenderImage>*); |
| 48 | 48 |
| 49 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } | 49 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } |
| 50 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } | 50 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } |
| 51 | 51 |
| 52 virtual void intrinsicSizeChanged() override | 52 virtual void intrinsicSizeChanged() override; |
| 53 { | |
| 54 if (m_imageResource) | |
| 55 imageChanged(m_imageResource->imagePtr()); | |
| 56 } | |
| 57 | 53 |
| 58 protected: | 54 private: |
| 59 virtual bool needsPreferredWidthsRecalculation() const override final; | 55 virtual bool needsPreferredWidthsRecalculation() const override final; |
| 60 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override final; | 56 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override final; |
| 61 | 57 |
| 62 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override; | 58 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override; |
| 63 | 59 |
| 64 void paintIntoRect(GraphicsContext*, const LayoutRect&); | 60 void paintIntoRect(GraphicsContext*, const LayoutRect&); |
| 65 virtual void paint(PaintInfo&, const LayoutPoint&) override final; | 61 virtual void paint(PaintInfo&, const LayoutPoint&) override final; |
| 66 virtual void layout() override; | 62 virtual void layout() override; |
| 67 | 63 |
| 68 private: | |
| 69 virtual const char* renderName() const override { return "RenderImage"; } | 64 virtual const char* renderName() const override { return "RenderImage"; } |
| 70 | 65 |
| 71 virtual bool isImage() const override { return true; } | 66 virtual bool isImage() const override { return true; } |
| 72 virtual bool isRenderImage() const override final { return true; } | 67 virtual bool isRenderImage() const override final { return true; } |
| 73 | 68 |
| 74 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) override; | 69 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) override; |
| 75 | 70 |
| 76 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const override final; | 71 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const override final; |
| 77 virtual bool computeBackgroundIsKnownToBeObscured() override final; | 72 virtual bool computeBackgroundIsKnownToBeObscured() override final; |
| 78 | 73 |
| 79 virtual LayoutUnit minimumReplacedHeight() const override; | 74 virtual LayoutUnit minimumReplacedHeight() const override; |
| 80 | 75 |
| 81 virtual void notifyFinished(Resource*) override final; | 76 virtual void notifyFinished(Resource*) override final; |
| 82 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; | 77 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; |
| 83 | 78 |
| 84 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override final; | 79 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override final; |
| 85 | 80 |
| 86 void paintInvalidationOrMarkForLayout(const IntRect* = 0); | 81 void paintInvalidationOrMarkForLayout(const IntRect* = 0); |
| 87 void updateIntrinsicSizeIfNeeded(const LayoutSize&); | 82 void updateIntrinsicSizeIfNeeded(const LayoutSize& newSize); |
| 88 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. | 83 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. |
| 89 void updateInnerContentRect(); | 84 void updateInnerContentRect(); |
| 90 | 85 |
| 91 void paintAreaElementFocusRing(PaintInfo&); | 86 void paintAreaElementFocusRing(PaintInfo&); |
| 92 | 87 |
| 93 OwnPtr<RenderImageResource> m_imageResource; | 88 OwnPtr<RenderImageResource> m_imageResource; |
| 94 float m_imageDevicePixelRatio; | 89 float m_imageDevicePixelRatio; |
| 95 | 90 |
| 96 friend class RenderImageScaleObserver; | 91 friend class RenderImageScaleObserver; |
| 97 }; | 92 }; |
| 98 | 93 |
| 99 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); | 94 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); |
| 100 | 95 |
| 101 } // namespace blink | 96 } // namespace blink |
| 102 | 97 |
| 103 #endif // RenderImage_h | 98 #endif // RenderImage_h |
| OLD | NEW |