| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | |
| 4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.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. | |
| 7 * | |
| 8 * This library is free software; you can redistribute it and/or | |
| 9 * modify it under the terms of the GNU Library General Public | |
| 10 * License as published by the Free Software Foundation; either | |
| 11 * version 2 of the License, or (at your option) any later version. | |
| 12 * | |
| 13 * This library is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 * Library General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU Library General Public License | |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 21 * Boston, MA 02110-1301, USA. | |
| 22 * | |
| 23 */ | |
| 24 | |
| 25 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERIMAGE_H_ | |
| 26 #define SKY_ENGINE_CORE_RENDERING_RENDERIMAGE_H_ | |
| 27 | |
| 28 #include "sky/engine/core/rendering/RenderImageResource.h" | |
| 29 #include "sky/engine/core/rendering/RenderReplaced.h" | |
| 30 | |
| 31 namespace blink { | |
| 32 | |
| 33 class RenderImage final : public RenderReplaced { | |
| 34 public: | |
| 35 RenderImage(Element*); | |
| 36 virtual ~RenderImage(); | |
| 37 virtual void destroy() override; | |
| 38 | |
| 39 void setImageResource(PassOwnPtr<RenderImageResource>); | |
| 40 | |
| 41 RenderImageResource* imageResource() { return m_imageResource.get(); } | |
| 42 const RenderImageResource* imageResource() const { return m_imageResource.ge
t(); } | |
| 43 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc
e->cachedImage() : 0; } | |
| 44 | |
| 45 void highQualityRepaintTimerFired(Timer<RenderImage>*); | |
| 46 | |
| 47 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } | |
| 48 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } | |
| 49 | |
| 50 virtual void intrinsicSizeChanged() override; | |
| 51 | |
| 52 private: | |
| 53 virtual bool needsPreferredWidthsRecalculation() const override final; | |
| 54 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override final; | |
| 55 | |
| 56 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) final; | |
| 57 | |
| 58 void paintIntoRect(GraphicsContext*, const LayoutRect&); | |
| 59 virtual void layout() override; | |
| 60 | |
| 61 virtual const char* renderName() const override { return "RenderImage"; } | |
| 62 | |
| 63 virtual bool isImage() const override { return true; } | |
| 64 virtual bool isRenderImage() const override final { return true; } | |
| 65 | |
| 66 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) override; | |
| 67 | |
| 68 virtual LayoutUnit minimumReplacedHeight() const override; | |
| 69 | |
| 70 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override f
inal; | |
| 71 | |
| 72 void updateIntrinsicSizeIfNeeded(const LayoutSize& newSize); | |
| 73 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. | |
| 74 void updateInnerContentRect(); | |
| 75 | |
| 76 OwnPtr<RenderImageResource> m_imageResource; | |
| 77 float m_imageDevicePixelRatio; | |
| 78 | |
| 79 friend class RenderImageScaleObserver; | |
| 80 }; | |
| 81 | |
| 82 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); | |
| 83 | |
| 84 } // namespace blink | |
| 85 | |
| 86 #endif // SKY_ENGINE_CORE_RENDERING_RENDERIMAGE_H_ | |
| OLD | NEW |