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

Unified Diff: third_party/WebKit/Source/core/css/CSSPaintValue.cpp

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSPaintValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
index 44f67d4d76ba43f56c7d69044b809521f32d0513..fa02a841c52c6adeeb8bf942d93a817d02998e9d 100644
--- a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
@@ -42,17 +42,19 @@ String CSSPaintValue::GetName() const {
return name_->Value();
}
-PassRefPtr<Image> CSSPaintValue::GetImage(const LayoutObject& layout_object,
+PassRefPtr<Image> CSSPaintValue::GetImage(const ImageResourceObserver& client,
+ const Document& document,
+ const ComputedStyle&,
const IntSize& size) {
- if (!generator_)
- generator_ =
- CSSPaintImageGenerator::Create(GetName(), layout_object.GetDocument(),
- paint_image_generator_observer_);
+ if (!generator_) {
+ generator_ = CSSPaintImageGenerator::Create(
+ GetName(), document, paint_image_generator_observer_);
+ }
if (!ParseInputArguments())
return nullptr;
- return generator_->Paint(layout_object, size, parsed_input_arguments_);
+ return generator_->Paint(client, size, parsed_input_arguments_);
}
bool CSSPaintValue::ParseInputArguments() {
@@ -94,8 +96,10 @@ void CSSPaintValue::Observer::PaintImageGeneratorReady() {
}
void CSSPaintValue::PaintImageGeneratorReady() {
- for (const LayoutObject* client : Clients().Keys()) {
- const_cast<LayoutObject*>(client)->ImageChanged(
+ for (const ImageResourceObserver* client : Clients().Keys()) {
+ // TODO(ikilpatrick): We shouldn't be casting like this or mutate the layout
+ // tree from a const pointer.
+ const_cast<ImageResourceObserver*>(client)->ImageChanged(
static_cast<WrappedImagePtr>(this));
}
}

Powered by Google App Engine
This is Rietveld 408576698