Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: third_party/WebKit/Source/core/style/ContentData.h

Issue 1607733004: Fix crash when using disallowed URLs in image sets for content CSS property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/ElementStyleResources.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698