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

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

Issue 2941533002: Break StyleImage dependency on LayoutObject (Closed)
Patch Set: Rebase w/HEAD 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 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 28
29 #include "core/css/CSSImageGeneratorValue.h" 29 #include "core/css/CSSImageGeneratorValue.h"
30 #include "core/css/CSSImageSetValue.h" 30 #include "core/css/CSSImageSetValue.h"
31 #include "core/css/CSSImageValue.h" 31 #include "core/css/CSSImageValue.h"
32 #include "core/css/CSSPaintValue.h" 32 #include "core/css/CSSPaintValue.h"
33 #include "core/style/StyleImage.h" 33 #include "core/style/StyleImage.h"
34 #include "platform/graphics/Image.h" 34 #include "platform/graphics/Image.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 class ImageResourceObserver;
39
38 // StylePendingImage is a placeholder StyleImage that is entered into the 40 // StylePendingImage is a placeholder StyleImage that is entered into the
39 // ComputedStyle during style resolution, in order to avoid loading images that 41 // ComputedStyle during style resolution, in order to avoid loading images that
40 // are not referenced by the final style. They should never exist in a 42 // are not referenced by the final style. They should never exist in a
41 // ComputedStyle after it has been returned from the style selector. 43 // ComputedStyle after it has been returned from the style selector.
42 44
43 class StylePendingImage final : public StyleImage { 45 class StylePendingImage final : public StyleImage {
44 public: 46 public:
45 static StylePendingImage* Create(const CSSValue& value) { 47 static StylePendingImage* Create(const CSSValue& value) {
46 return new StylePendingImage(value); 48 return new StylePendingImage(value);
47 } 49 }
(...skipping 22 matching lines...) Expand all
70 return value_->IsImageSetValue() ? ToCSSImageSetValue(value_.Get()) : 0; 72 return value_->IsImageSetValue() ? ToCSSImageSetValue(value_.Get()) : 0;
71 } 73 }
72 74
73 LayoutSize ImageSize(const Document&, 75 LayoutSize ImageSize(const Document&,
74 float /*multiplier*/, 76 float /*multiplier*/,
75 const LayoutSize& /*defaultObjectSize*/) const override { 77 const LayoutSize& /*defaultObjectSize*/) const override {
76 return LayoutSize(); 78 return LayoutSize();
77 } 79 }
78 bool ImageHasRelativeSize() const override { return false; } 80 bool ImageHasRelativeSize() const override { return false; }
79 bool UsesImageContainerSize() const override { return false; } 81 bool UsesImageContainerSize() const override { return false; }
80 void AddClient(LayoutObject*) override {} 82 void AddClient(ImageResourceObserver*) override {}
81 void RemoveClient(LayoutObject*) override {} 83 void RemoveClient(ImageResourceObserver*) override {}
82 PassRefPtr<Image> GetImage(const LayoutObject&, 84 PassRefPtr<Image> GetImage(const ImageResourceObserver&,
85 const Document&,
86 const ComputedStyle&,
83 const IntSize&) const override { 87 const IntSize&) const override {
84 NOTREACHED(); 88 NOTREACHED();
85 return nullptr; 89 return nullptr;
86 } 90 }
87 bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override { 91 bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override {
88 return false; 92 return false;
89 } 93 }
90 94
91 DEFINE_INLINE_VIRTUAL_TRACE() { 95 DEFINE_INLINE_VIRTUAL_TRACE() {
92 visitor->Trace(value_); 96 visitor->Trace(value_);
93 StyleImage::Trace(visitor); 97 StyleImage::Trace(visitor);
94 } 98 }
95 99
96 private: 100 private:
97 explicit StylePendingImage(const CSSValue& value) 101 explicit StylePendingImage(const CSSValue& value)
98 : value_(const_cast<CSSValue*>(&value)) { 102 : value_(const_cast<CSSValue*>(&value)) {
99 is_pending_image_ = true; 103 is_pending_image_ = true;
100 } 104 }
101 105
102 // TODO(sashab): Replace this with <const CSSValue> once Member<> 106 // TODO(sashab): Replace this with <const CSSValue> once Member<>
103 // supports const types. 107 // supports const types.
104 Member<CSSValue> value_; 108 Member<CSSValue> value_;
105 }; 109 };
106 110
107 DEFINE_STYLE_IMAGE_TYPE_CASTS(StylePendingImage, IsPendingImage()); 111 DEFINE_STYLE_IMAGE_TYPE_CASTS(StylePendingImage, IsPendingImage());
108 112
109 } // namespace blink 113 } // namespace blink
110 #endif 114 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698