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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp

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 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 bool StyleFetchedImageSet::ImageHasRelativeSize() const { 102 bool StyleFetchedImageSet::ImageHasRelativeSize() const {
103 return best_fit_image_->ImageHasRelativeSize(); 103 return best_fit_image_->ImageHasRelativeSize();
104 } 104 }
105 105
106 bool StyleFetchedImageSet::UsesImageContainerSize() const { 106 bool StyleFetchedImageSet::UsesImageContainerSize() const {
107 return best_fit_image_->UsesImageContainerSize(); 107 return best_fit_image_->UsesImageContainerSize();
108 } 108 }
109 109
110 void StyleFetchedImageSet::AddClient(LayoutObject* layout_object) { 110 void StyleFetchedImageSet::AddClient(ImageResourceObserver* observer) {
111 best_fit_image_->AddObserver(layout_object); 111 best_fit_image_->AddObserver(observer);
112 } 112 }
113 113
114 void StyleFetchedImageSet::RemoveClient(LayoutObject* layout_object) { 114 void StyleFetchedImageSet::RemoveClient(ImageResourceObserver* observer) {
115 best_fit_image_->RemoveObserver(layout_object); 115 best_fit_image_->RemoveObserver(observer);
116 } 116 }
117 117
118 PassRefPtr<Image> StyleFetchedImageSet::GetImage( 118 PassRefPtr<Image> StyleFetchedImageSet::GetImage(
119 const LayoutObject& obj, 119 const ImageResourceObserver&,
120 const Document&,
121 const ComputedStyle& style,
120 const IntSize& container_size) const { 122 const IntSize& container_size) const {
121 if (!best_fit_image_->GetImage()->IsSVGImage()) 123 if (!best_fit_image_->GetImage()->IsSVGImage())
122 return best_fit_image_->GetImage(); 124 return best_fit_image_->GetImage();
123 125
124 return SVGImageForContainer::Create(ToSVGImage(best_fit_image_->GetImage()), 126 return SVGImageForContainer::Create(ToSVGImage(best_fit_image_->GetImage()),
125 container_size, 127 container_size, style.EffectiveZoom(),
126 obj.StyleRef().EffectiveZoom(), url_); 128 url_);
127 } 129 }
128 130
129 bool StyleFetchedImageSet::KnownToBeOpaque(const Document&, 131 bool StyleFetchedImageSet::KnownToBeOpaque(const Document&,
130 const ComputedStyle&) const { 132 const ComputedStyle&) const {
131 return best_fit_image_->GetImage()->CurrentFrameKnownToBeOpaque( 133 return best_fit_image_->GetImage()->CurrentFrameKnownToBeOpaque(
132 Image::kPreCacheMetadata); 134 Image::kPreCacheMetadata);
133 } 135 }
134 136
135 DEFINE_TRACE(StyleFetchedImageSet) { 137 DEFINE_TRACE(StyleFetchedImageSet) {
136 visitor->Trace(best_fit_image_); 138 visitor->Trace(best_fit_image_);
137 visitor->Trace(image_set_value_); 139 visitor->Trace(image_set_value_);
138 StyleImage::Trace(visitor); 140 StyleImage::Trace(visitor);
139 } 141 }
140 142
141 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698