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

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

Issue 1472253003: Avoid RefPtr churn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImage.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 m_bestFitImage->addClient(layoutObject); 116 m_bestFitImage->addClient(layoutObject);
117 } 117 }
118 118
119 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject) 119 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject)
120 { 120 {
121 m_bestFitImage->removeClient(layoutObject); 121 m_bestFitImage->removeClient(layoutObject);
122 } 122 }
123 123
124 PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject*, const IntSize & containerSize, float zoom) const 124 PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject*, const IntSize & containerSize, float zoom) const
125 { 125 {
126 RefPtr<Image> image = m_bestFitImage->image(); 126 if (!m_bestFitImage->image()->isSVGImage())
127 if (image && image->isSVGImage()) 127 return m_bestFitImage->image();
128 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi ze, zoom, m_url); 128
129 return image; 129 return SVGImageForContainer::create(toSVGImage(m_bestFitImage->image()), con tainerSize, zoom, m_url);
130 } 130 }
131 131
132 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con st 132 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con st
133 { 133 {
134 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject); 134 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject);
135 } 135 }
136 136
137 DEFINE_TRACE(StyleFetchedImageSet) 137 DEFINE_TRACE(StyleFetchedImageSet)
138 { 138 {
139 visitor->trace(m_imageSetValue); 139 visitor->trace(m_imageSetValue);
140 StyleImage::trace(visitor); 140 StyleImage::trace(visitor);
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698