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

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

Issue 2941533002: Break StyleImage dependency on LayoutObject (Closed)
Patch Set: Address reviewer comments Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef StyleInvalidImage_h 5 #ifndef StyleInvalidImage_h
6 #define StyleInvalidImage_h 6 #define StyleInvalidImage_h
7 7
8 #include "core/css/CSSImageValue.h" 8 #include "core/css/CSSImageValue.h"
9 #include "core/style/StyleImage.h" 9 #include "core/style/StyleImage.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class ImageResourceObserver;
14
13 class StyleInvalidImage final : public StyleImage { 15 class StyleInvalidImage final : public StyleImage {
14 public: 16 public:
15 static StyleInvalidImage* Create(const String& url) { 17 static StyleInvalidImage* Create(const String& url) {
16 return new StyleInvalidImage(url); 18 return new StyleInvalidImage(url);
17 } 19 }
18 20
19 WrappedImagePtr Data() const override { return url_.Impl(); } 21 WrappedImagePtr Data() const override { return url_.Impl(); }
20 22
21 CSSValue* CssValue() const override { 23 CSSValue* CssValue() const override {
22 return CSSImageValue::Create(AtomicString(url_)); 24 return CSSImageValue::Create(AtomicString(url_));
23 } 25 }
24 26
25 CSSValue* ComputedCSSValue() const override { return CssValue(); } 27 CSSValue* ComputedCSSValue() const override { return CssValue(); }
26 28
27 LayoutSize ImageSize(const Document&, 29 LayoutSize ImageSize(const Document&,
28 float /*multiplier*/, 30 float /*multiplier*/,
29 const LayoutSize& /*defaultObjectSize*/) const override { 31 const LayoutSize& /*defaultObjectSize*/) const override {
30 return LayoutSize(); 32 return LayoutSize();
31 } 33 }
32 bool ImageHasRelativeSize() const override { return false; } 34 bool ImageHasRelativeSize() const override { return false; }
33 bool UsesImageContainerSize() const override { return false; } 35 bool UsesImageContainerSize() const override { return false; }
34 void AddClient(LayoutObject*) override {} 36 void AddClient(ImageResourceObserver*) override {}
35 void RemoveClient(LayoutObject*) override {} 37 void RemoveClient(ImageResourceObserver*) override {}
36 PassRefPtr<Image> GetImage(const LayoutObject&, 38 PassRefPtr<Image> GetImage(const ImageResourceObserver&,
39 const Document&,
40 const ComputedStyle&,
37 const IntSize&) const override { 41 const IntSize&) const override {
38 return nullptr; 42 return nullptr;
39 } 43 }
40 bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override { 44 bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override {
41 return false; 45 return false;
42 } 46 }
43 47
44 DEFINE_INLINE_VIRTUAL_TRACE() { StyleImage::Trace(visitor); } 48 DEFINE_INLINE_VIRTUAL_TRACE() { StyleImage::Trace(visitor); }
45 49
46 private: 50 private:
47 explicit StyleInvalidImage(const String& url) : url_(url) { 51 explicit StyleInvalidImage(const String& url) : url_(url) {
48 is_invalid_image_ = true; 52 is_invalid_image_ = true;
49 } 53 }
50 54
51 String url_; 55 String url_;
52 }; 56 };
53 57
54 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleInvalidImage, IsInvalidImage()); 58 DEFINE_STYLE_IMAGE_TYPE_CASTS(StyleInvalidImage, IsInvalidImage());
55 59
56 } // namespace blink 60 } // namespace blink
57 #endif 61 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleImage.h ('k') | third_party/WebKit/Source/core/style/StylePendingImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698