| 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 LayoutImage_h | 25 #ifndef LayoutImage_h |
| 26 #define LayoutImage_h | 26 #define LayoutImage_h |
| 27 | 27 |
| 28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
| 29 #include "core/fetch/ResourceClient.h" |
| 29 #include "core/layout/LayoutImageResource.h" | 30 #include "core/layout/LayoutImageResource.h" |
| 30 #include "core/layout/LayoutReplaced.h" | 31 #include "core/layout/LayoutReplaced.h" |
| 31 | 32 |
| 32 namespace blink { | 33 namespace blink { |
| 33 | 34 |
| 34 class HTMLAreaElement; | 35 class HTMLAreaElement; |
| 35 class HTMLMapElement; | 36 class HTMLMapElement; |
| 36 | 37 |
| 37 // LayoutImage is used to display any image type. | 38 // LayoutImage is used to display any image type. |
| 38 // | 39 // |
| 39 // There is 2 types of images: | 40 // There is 2 types of images: |
| 40 // * normal images, e.g. <image>, <picture>. | 41 // * normal images, e.g. <image>, <picture>. |
| 41 // * content images with "content: url(path/to/image.png)". | 42 // * content images with "content: url(path/to/image.png)". |
| 42 // We store the type inside m_isGeneratedContent. | 43 // We store the type inside m_isGeneratedContent. |
| 43 // | 44 // |
| 44 // The class is image type agnostic as it only manipulates decoded images. | 45 // The class is image type agnostic as it only manipulates decoded images. |
| 45 // See LayoutImageResource that holds this image. | 46 // See LayoutImageResource that holds this image. |
| 46 class CORE_EXPORT LayoutImage : public LayoutReplaced { | 47 class CORE_EXPORT LayoutImage : public LayoutReplaced, public ResourceClient { |
| 47 public: | 48 public: |
| 48 // These are the paddings to use when displaying either alt text or an image
. | 49 // These are the paddings to use when displaying either alt text or an image
. |
| 49 static const unsigned short paddingWidth = 4; | 50 static const unsigned short paddingWidth = 4; |
| 50 static const unsigned short paddingHeight = 4; | 51 static const unsigned short paddingHeight = 4; |
| 51 | 52 |
| 52 LayoutImage(Element*); | 53 LayoutImage(Element*); |
| 53 ~LayoutImage() override; | 54 ~LayoutImage() override; |
| 54 | 55 |
| 55 static LayoutImage* createAnonymous(Document*); | 56 static LayoutImage* createAnonymous(Document*); |
| 56 | 57 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } | 71 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio
= factor; } |
| 71 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } | 72 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } |
| 72 | 73 |
| 73 void intrinsicSizeChanged() override | 74 void intrinsicSizeChanged() override |
| 74 { | 75 { |
| 75 if (m_imageResource) | 76 if (m_imageResource) |
| 76 imageChanged(m_imageResource->imagePtr()); | 77 imageChanged(m_imageResource->imagePtr()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 const char* name() const override { return "LayoutImage"; } | 80 const char* name() const override { return "LayoutImage"; } |
| 81 String debugName() const final { return LayoutObject::debugName(); } |
| 80 | 82 |
| 81 protected: | 83 protected: |
| 82 bool needsPreferredWidthsRecalculation() const final; | 84 bool needsPreferredWidthsRecalculation() const final; |
| 83 LayoutReplaced* embeddedReplacedContent() const final; | 85 LayoutReplaced* embeddedReplacedContent() const final; |
| 84 void computeIntrinsicSizingInfo(IntrinsicSizingInfo&) const final; | 86 void computeIntrinsicSizingInfo(IntrinsicSizingInfo&) const final; |
| 85 | 87 |
| 86 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; | 88 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; |
| 87 | 89 |
| 88 void paint(const PaintInfo&, const LayoutPoint&) const final; | 90 void paint(const PaintInfo&, const LayoutPoint&) const final; |
| 89 | 91 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // This field stores whether this image is generated with 'content'. | 130 // This field stores whether this image is generated with 'content'. |
| 129 bool m_isGeneratedContent; | 131 bool m_isGeneratedContent; |
| 130 float m_imageDevicePixelRatio; | 132 float m_imageDevicePixelRatio; |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutImage, isLayoutImage()); | 135 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutImage, isLayoutImage()); |
| 134 | 136 |
| 135 } // namespace blink | 137 } // namespace blink |
| 136 | 138 |
| 137 #endif // LayoutImage_h | 139 #endif // LayoutImage_h |
| OLD | NEW |