| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef RenderImage_h | 25 #ifndef LayoutImage_h |
| 26 #define RenderImage_h | 26 #define LayoutImage_h |
| 27 | 27 |
| 28 #include "core/rendering/RenderImageResource.h" | 28 #include "core/layout/LayoutImageResource.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 HTMLAreaElement; | 33 class HTMLAreaElement; |
| 34 class HTMLMapElement; | 34 class HTMLMapElement; |
| 35 | 35 |
| 36 class RenderImage : public RenderReplaced { | 36 class LayoutImage : 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 LayoutImage(Element*); |
| 43 virtual ~RenderImage(); | 43 virtual ~LayoutImage(); |
| 44 virtual void destroy() override; | 44 virtual void destroy() override; |
| 45 | 45 |
| 46 static RenderImage* createAnonymous(Document*); | 46 static LayoutImage* createAnonymous(Document*); |
| 47 | 47 |
| 48 void setImageResource(PassOwnPtr<RenderImageResource>); | 48 void setImageResource(PassOwnPtr<LayoutImageResource>); |
| 49 | 49 |
| 50 RenderImageResource* imageResource() { return m_imageResource.get(); } | 50 LayoutImageResource* imageResource() { return m_imageResource.get(); } |
| 51 const RenderImageResource* imageResource() const { return m_imageResource.ge
t(); } | 51 const LayoutImageResource* 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 HTMLMapElement* imageMap() const; | 54 HTMLMapElement* imageMap() const; |
| 55 void areaElementFocusChanged(HTMLAreaElement*); | 55 void areaElementFocusChanged(HTMLAreaElement*); |
| 56 | 56 |
| 57 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g
enerated; } | 57 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g
enerated; } |
| 58 | 58 |
| 59 bool isGeneratedContent() const { return m_isGeneratedContent; } | 59 bool isGeneratedContent() const { return m_isGeneratedContent; } |
| 60 | 60 |
| 61 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } | 61 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 virtual RenderBox* embeddedContentBox() const override final; | 72 virtual RenderBox* embeddedContentBox() const override final; |
| 73 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override final; | 73 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override final; |
| 74 | 74 |
| 75 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override; | 75 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override; |
| 76 | 76 |
| 77 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; | 77 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; |
| 78 | 78 |
| 79 virtual void layout() override; | 79 virtual void layout() override; |
| 80 virtual bool updateImageLoadingPriorities() override final; | 80 virtual bool updateImageLoadingPriorities() override final; |
| 81 | 81 |
| 82 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectRenderImage || RenderReplaced::isOfType(type); } | 82 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectLayoutImage || RenderReplaced::isOfType(type); } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 virtual const char* renderName() const override { return "RenderImage"; } | 85 virtual const char* renderName() const override { return "LayoutImage"; } |
| 86 | 86 |
| 87 virtual bool isImage() const override { return true; } | 87 virtual bool isImage() const override { return true; } |
| 88 | 88 |
| 89 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override; | 89 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override; |
| 90 | 90 |
| 91 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const override final; | 91 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned maxDepthToTest) const override final; |
| 92 virtual bool computeBackgroundIsKnownToBeObscured() override final; | 92 virtual bool computeBackgroundIsKnownToBeObscured() override final; |
| 93 | 93 |
| 94 virtual bool backgroundShouldAlwaysBeClipped() const override { return true;
} | 94 virtual bool backgroundShouldAlwaysBeClipped() const override { return true;
} |
| 95 | 95 |
| 96 virtual LayoutUnit minimumReplacedHeight() const override; | 96 virtual LayoutUnit minimumReplacedHeight() const override; |
| 97 | 97 |
| 98 virtual void notifyFinished(Resource*) override final; | 98 virtual void notifyFinished(Resource*) override final; |
| 99 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; | 99 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; |
| 100 | 100 |
| 101 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override final; | 101 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override final; |
| 102 | 102 |
| 103 void repaintOrMarkForLayout(const IntRect* = 0); | 103 void repaintOrMarkForLayout(const IntRect* = 0); |
| 104 void updateIntrinsicSizeIfNeeded(const LayoutSize&); | 104 void updateIntrinsicSizeIfNeeded(const LayoutSize&); |
| 105 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. | 105 // Update the size of the image to be rendered. Object-fit may cause this to
be different from the CSS box's content rect. |
| 106 void updateInnerContentRect(); | 106 void updateInnerContentRect(); |
| 107 | 107 |
| 108 // Text to display as long as the image isn't available. | 108 // Text to display as long as the image isn't available. |
| 109 OwnPtr<RenderImageResource> m_imageResource; | 109 OwnPtr<LayoutImageResource> m_imageResource; |
| 110 bool m_didIncrementVisuallyNonEmptyPixelCount; | 110 bool m_didIncrementVisuallyNonEmptyPixelCount; |
| 111 bool m_isGeneratedContent; | 111 bool m_isGeneratedContent; |
| 112 float m_imageDevicePixelRatio; | 112 float m_imageDevicePixelRatio; |
| 113 | |
| 114 friend class RenderImageScaleObserver; | |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); | 115 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutImage, isLayoutImage()); |
| 118 | 116 |
| 119 } // namespace blink | 117 } // namespace blink |
| 120 | 118 |
| 121 #endif // RenderImage_h | 119 #endif // LayoutImage_h |
| OLD | NEW |