| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #define DEFINE_CONTENT_DATA_TYPE_CASTS(typeName) \ | 71 #define DEFINE_CONTENT_DATA_TYPE_CASTS(typeName) \ |
| 72 DEFINE_TYPE_CASTS(typeName##ContentData, ContentData, content, content->is##
typeName(), content.is##typeName()) | 72 DEFINE_TYPE_CASTS(typeName##ContentData, ContentData, content, content->is##
typeName(), content.is##typeName()) |
| 73 | 73 |
| 74 class ImageContentData final : public ContentData { | 74 class ImageContentData final : public ContentData { |
| 75 friend class ContentData; | 75 friend class ContentData; |
| 76 public: | 76 public: |
| 77 const StyleImage* image() const { return m_image.get(); } | 77 const StyleImage* image() const { return m_image.get(); } |
| 78 StyleImage* image() { return m_image.get(); } | 78 StyleImage* image() { return m_image.get(); } |
| 79 void setImage(PassRefPtrWillBeRawPtr<StyleImage> image) { m_image = image; } | 79 void setImage(PassRefPtrWillBeRawPtr<StyleImage> image) { ASSERT(image); m_i
mage = image; } |
| 80 | 80 |
| 81 bool isImage() const override { return true; } | 81 bool isImage() const override { return true; } |
| 82 LayoutObject* createLayoutObject(Document&, ComputedStyle&) const override; | 82 LayoutObject* createLayoutObject(Document&, ComputedStyle&) const override; |
| 83 | 83 |
| 84 bool equals(const ContentData& data) const override | 84 bool equals(const ContentData& data) const override |
| 85 { | 85 { |
| 86 if (!data.isImage()) | 86 if (!data.isImage()) |
| 87 return false; | 87 return false; |
| 88 return *static_cast<const ImageContentData&>(data).image() == *image(); | 88 return *static_cast<const ImageContentData&>(data).image() == *image(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 DECLARE_VIRTUAL_TRACE(); | 91 DECLARE_VIRTUAL_TRACE(); |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 ImageContentData(PassRefPtrWillBeRawPtr<StyleImage> image) | 94 ImageContentData(PassRefPtrWillBeRawPtr<StyleImage> image) |
| 95 : m_image(image) | 95 : m_image(image) |
| 96 { | 96 { |
| 97 ASSERT(m_image); |
| 97 } | 98 } |
| 98 | 99 |
| 99 PassOwnPtrWillBeRawPtr<ContentData> cloneInternal() const override | 100 PassOwnPtrWillBeRawPtr<ContentData> cloneInternal() const override |
| 100 { | 101 { |
| 101 RefPtrWillBeRawPtr<StyleImage> image = const_cast<StyleImage*>(this->ima
ge()); | 102 RefPtrWillBeRawPtr<StyleImage> image = const_cast<StyleImage*>(this->ima
ge()); |
| 102 return create(image.release()); | 103 return create(image.release()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 RefPtrWillBeMember<StyleImage> m_image; | 106 RefPtrWillBeMember<StyleImage> m_image; |
| 106 }; | 107 }; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 205 } |
| 205 | 206 |
| 206 inline bool operator!=(const ContentData& a, const ContentData& b) | 207 inline bool operator!=(const ContentData& a, const ContentData& b) |
| 207 { | 208 { |
| 208 return !(a == b); | 209 return !(a == b); |
| 209 } | 210 } |
| 210 | 211 |
| 211 } // namespace blink | 212 } // namespace blink |
| 212 | 213 |
| 213 #endif // ContentData_h | 214 #endif // ContentData_h |
| OLD | NEW |