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

Unified Diff: third_party/WebKit/Source/core/css/CSSGradientValue.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/CSSGradientValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
index 201bf2789a3e2103a41d5d09509c8893ceca331b..51f8483565fbcfb84a17bd087babae7697affe83 100644
--- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
@@ -101,19 +101,22 @@ DEFINE_TRACE(CSSGradientColorStop) {
visitor->Trace(color_);
}
-PassRefPtr<Image> CSSGradientValue::GetImage(const LayoutObject& layout_object,
- const IntSize& size) {
+PassRefPtr<Image> CSSGradientValue::GetImage(
+ const ImageResourceObserver& client,
+ const Document& document,
+ const ComputedStyle& style,
+ const IntSize& size) {
if (size.IsEmpty())
return nullptr;
if (is_cacheable_) {
- if (!Clients().Contains(&layout_object))
+ if (!Clients().Contains(&client))
return nullptr;
// Need to look up our size. Create a string of width*height to use as a
// hash key.
Image* result =
- this->CSSImageGeneratorValue::GetImage(&layout_object, size);
+ this->CSSImageGeneratorValue::GetImage(&client, document, style, size);
if (result)
return result;
}
@@ -122,10 +125,12 @@ PassRefPtr<Image> CSSGradientValue::GetImage(const LayoutObject& layout_object,
RefPtr<Gradient> gradient;
const ComputedStyle* root_style =
- layout_object.GetDocument().documentElement()->GetComputedStyle();
+ document.documentElement()->GetComputedStyle();
+ // TODO: Break dependency on LayoutObject.
+ const LayoutObject& layout_object = static_cast<const LayoutObject&>(client);
CSSToLengthConversionData conversion_data(
- layout_object.Style(), root_style, LayoutViewItem(layout_object.View()),
- layout_object.Style()->EffectiveZoom());
+ &style, root_style, LayoutViewItem(layout_object.View()),
ikilpatrick 2017/06/13 18:41:00 LayoutViewItem(document.View());
+ style.EffectiveZoom());
switch (GetClassType()) {
case kLinearGradientClass:

Powered by Google App Engine
This is Rietveld 408576698