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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleFetchedImage.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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 bool StyleFetchedImage::ImageHasRelativeSize() const { 96 bool StyleFetchedImage::ImageHasRelativeSize() const {
97 return image_->ImageHasRelativeSize(); 97 return image_->ImageHasRelativeSize();
98 } 98 }
99 99
100 bool StyleFetchedImage::UsesImageContainerSize() const { 100 bool StyleFetchedImage::UsesImageContainerSize() const {
101 return image_->UsesImageContainerSize(); 101 return image_->UsesImageContainerSize();
102 } 102 }
103 103
104 void StyleFetchedImage::AddClient(LayoutObject* layout_object) { 104 void StyleFetchedImage::AddClient(ImageResourceObserver* observer) {
105 image_->AddObserver(layout_object); 105 image_->AddObserver(observer);
106 } 106 }
107 107
108 void StyleFetchedImage::RemoveClient(LayoutObject* layout_object) { 108 void StyleFetchedImage::RemoveClient(ImageResourceObserver* observer) {
109 image_->RemoveObserver(layout_object); 109 image_->RemoveObserver(observer);
110 } 110 }
111 111
112 void StyleFetchedImage::ImageNotifyFinished(ImageResourceContent*) { 112 void StyleFetchedImage::ImageNotifyFinished(ImageResourceContent*) {
113 if (document_ && image_ && image_->GetImage() && 113 if (document_ && image_ && image_->GetImage() &&
114 image_->GetImage()->IsSVGImage()) 114 image_->GetImage()->IsSVGImage())
115 ToSVGImage(image_->GetImage())->UpdateUseCounters(*document_); 115 ToSVGImage(image_->GetImage())->UpdateUseCounters(*document_);
116 // Oilpan: do not prolong the Document's lifetime. 116 // Oilpan: do not prolong the Document's lifetime.
117 document_.Clear(); 117 document_.Clear();
118 } 118 }
119 119
120 PassRefPtr<Image> StyleFetchedImage::GetImage( 120 PassRefPtr<Image> StyleFetchedImage::GetImage(
121 const LayoutObject& obj, 121 const ImageResourceObserver&,
122 const Document&,
123 const ComputedStyle& style,
122 const IntSize& container_size) const { 124 const IntSize& container_size) const {
123 if (!image_->GetImage()->IsSVGImage()) 125 if (!image_->GetImage()->IsSVGImage())
124 return image_->GetImage(); 126 return image_->GetImage();
125 127
126 return SVGImageForContainer::Create(ToSVGImage(image_->GetImage()), 128 return SVGImageForContainer::Create(ToSVGImage(image_->GetImage()),
127 container_size, 129 container_size, style.EffectiveZoom(),
128 obj.StyleRef().EffectiveZoom(), url_); 130 url_);
129 } 131 }
130 132
131 bool StyleFetchedImage::KnownToBeOpaque(const Document&, 133 bool StyleFetchedImage::KnownToBeOpaque(const Document&,
132 const ComputedStyle&) const { 134 const ComputedStyle&) const {
133 return image_->GetImage()->CurrentFrameKnownToBeOpaque( 135 return image_->GetImage()->CurrentFrameKnownToBeOpaque(
134 Image::kPreCacheMetadata); 136 Image::kPreCacheMetadata);
135 } 137 }
136 138
137 DEFINE_TRACE(StyleFetchedImage) { 139 DEFINE_TRACE(StyleFetchedImage) {
138 visitor->Trace(image_); 140 visitor->Trace(image_);
139 visitor->Trace(document_); 141 visitor->Trace(document_);
140 StyleImage::Trace(visitor); 142 StyleImage::Trace(visitor);
141 } 143 }
142 144
143 } // namespace blink 145 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImage.h ('k') | third_party/WebKit/Source/core/style/StyleFetchedImageSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698