Changeset 204560 in webkit
- Timestamp:
- Aug 17, 2016 9:37:45 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r204531 r204560 2579 2579 rendering/style/StyleBoxData.cpp 2580 2580 rendering/style/StyleCachedImage.cpp 2581 rendering/style/StyleCachedImageSet.cpp2582 2581 rendering/style/StyleDeprecatedFlexibleBoxData.cpp 2583 2582 rendering/style/StyleFilterData.cpp -
trunk/Source/WebCore/ChangeLog
r204558 r204560 1 2016-08-17 Antti Koivisto <antti@apple.com> 2 3 Remove StyleCachedImageSet 4 https://bugs.webkit.org/show_bug.cgi?id=160941 5 6 Reviewed by Simon Fraser. 7 8 It is almost the same as StyleCachedImage. Just use that. 9 10 * CMakeLists.txt: 11 * WebCore.xcodeproj/project.pbxproj: 12 * css/CSSCursorImageValue.cpp: 13 (WebCore::CSSCursorImageValue::cachedImage): 14 * css/CSSImageSetValue.cpp: 15 (WebCore::CSSImageSetValue::detachPendingImage): 16 (WebCore::CSSImageSetValue::~CSSImageSetValue): 17 (WebCore::CSSImageSetValue::fillImageSet): 18 (WebCore::CSSImageSetValue::bestImageForScaleFactor): 19 (WebCore::CSSImageSetValue::bestFitImage): 20 (WebCore::CSSImageSetValue::cachedOrPendingImageSet): 21 (WebCore::CSSImageSetValue::customCSSText): 22 (WebCore::CSSImageSetValue::traverseSubresources): 23 (WebCore::CSSImageSetValue::cachedImageSet): Deleted. 24 * css/CSSImageSetValue.h: 25 (WebCore::CSSImageSetValue::create): 26 (WebCore::CSSImageSetValue::compareByScaleFactor): 27 * css/StyleResolver.cpp: 28 * page/EventHandler.cpp: 29 * rendering/style/ShapeValue.cpp: 30 (WebCore::ShapeValue::isImageValid): 31 * rendering/style/StyleAllInOne.cpp: 32 * rendering/style/StyleCachedImage.cpp: 33 (WebCore::StyleCachedImage::StyleCachedImage): 34 35 Add scale factor and CSSImageSetValue backpointer, the only additional features of StyleCachedImageSet. 36 37 (WebCore::StyleCachedImage::cssValue): 38 (WebCore::StyleCachedImage::imageSize): 39 (WebCore::StyleCachedImage::imageHasRelativeWidth): 40 * rendering/style/StyleCachedImage.h: 41 * rendering/style/StyleCachedImageSet.cpp: Removed. 42 * rendering/style/StyleCachedImageSet.h: Removed. 43 * rendering/style/StyleImage.h: 44 (WebCore::StyleImage::isCachedImage): 45 (WebCore::StyleImage::isPendingImage): 46 (WebCore::StyleImage::isGeneratedImage): 47 (WebCore::StyleImage::StyleImage): 48 (WebCore::StyleImage::isCachedImageSet): Deleted. 49 * style/StylePendingResources.cpp: 50 (WebCore::Style::loadPendingImage): 51 1 52 2016-08-17 Per Arne Vollan <pvollan@apple.com> 2 53 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r204532 r204560 3578 3578 9393E5FF151A99F200066F06 /* CSSImageSetValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9393E5FD151A99F200066F06 /* CSSImageSetValue.cpp */; }; 3579 3579 9393E600151A99F200066F06 /* CSSImageSetValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9393E5FE151A99F200066F06 /* CSSImageSetValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3580 9393E604151A9A1800066F06 /* StyleCachedImageSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9393E602151A9A1800066F06 /* StyleCachedImageSet.cpp */; };3581 9393E605151A9A1800066F06 /* StyleCachedImageSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 9393E603151A9A1800066F06 /* StyleCachedImageSet.h */; };3582 3580 939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939885C108B7E3D100E707C4 /* EventNames.cpp */; }; 3583 3581 939885C408B7E3D100E707C4 /* EventNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 939885C208B7E3D100E707C4 /* EventNames.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 11092 11090 9393E5FD151A99F200066F06 /* CSSImageSetValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSImageSetValue.cpp; sourceTree = "<group>"; }; 11093 11091 9393E5FE151A99F200066F06 /* CSSImageSetValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSImageSetValue.h; sourceTree = "<group>"; }; 11094 9393E602151A9A1800066F06 /* StyleCachedImageSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleCachedImageSet.cpp; sourceTree = "<group>"; };11095 9393E603151A9A1800066F06 /* StyleCachedImageSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleCachedImageSet.h; sourceTree = "<group>"; };11096 11092 93955A4103D72932008635CE /* RenderTreeAsText.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeAsText.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 11097 11093 93955A4203D72932008635CE /* RenderTreeAsText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeAsText.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 22278 22274 BCEF44790E6747D0001C1287 /* StyleCachedImage.cpp */, 22279 22275 BCEF444C0E674628001C1287 /* StyleCachedImage.h */, 22280 9393E602151A9A1800066F06 /* StyleCachedImageSet.cpp */,22281 9393E603151A9A1800066F06 /* StyleCachedImageSet.h */,22282 22276 9DAC7C561AF2CB6400437C44 /* StyleContentAlignmentData.h */, 22283 22277 BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */, … … 27652 27646 835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */, 27653 27647 BCEF444D0E674628001C1287 /* StyleCachedImage.h in Headers */, 27654 9393E605151A9A1800066F06 /* StyleCachedImageSet.h in Headers */,27655 27648 E401E0A41C3C0B8300F34D10 /* StyleChange.h in Headers */, 27656 27649 9DAC7C571AF2CB6400437C44 /* StyleContentAlignmentData.h in Headers */, … … 31279 31272 8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */, 31280 31273 BCEF447A0E6747D0001C1287 /* StyleCachedImage.cpp in Sources */, 31281 9393E604151A9A1800066F06 /* StyleCachedImageSet.cpp in Sources */,31282 31274 E401E0A61C3C0CF700F34D10 /* StyleChange.cpp in Sources */, 31283 31275 A8C4A7FE09D563270003AC8D /* StyledElement.cpp in Sources */, -
trunk/Source/WebCore/css/CSSCursorImageValue.cpp
r202656 r204560 23 23 #include "CSSCursorImageValue.h" 24 24 25 #include "CSSImageSetValue.h" 25 26 #include "CSSImageValue.h" 26 27 #include "CachedImage.h" … … 40 41 #if ENABLE(CSS_IMAGE_SET) 41 42 #include "CSSImageSetValue.h" 42 #include "StyleCachedImageSet.h"43 43 #endif 44 44 … … 121 121 #if ENABLE(CSS_IMAGE_SET) 122 122 if (is<CSSImageSetValue>(m_imageValue.get())) 123 return downcast<CSSImageSetValue>(m_imageValue.get()). cachedImageSet(loader, options);123 return downcast<CSSImageSetValue>(m_imageValue.get()).bestFitImage(loader, options); 124 124 #endif 125 125 -
trunk/Source/WebCore/css/CSSImageSetValue.cpp
r204014 r204560 38 38 #include "Document.h" 39 39 #include "Page.h" 40 #include "StyleCachedImage Set.h"40 #include "StyleCachedImage.h" 41 41 #include "StylePendingImage.h" 42 42 #include <wtf/text/StringBuilder.h> … … 53 53 inline void CSSImageSetValue::detachPendingImage() 54 54 { 55 if (is<StylePendingImage>(m_image Set.get()))56 downcast<StylePendingImage>(*m_image Set).detachFromCSSValue();55 if (is<StylePendingImage>(m_image.get())) 56 downcast<StylePendingImage>(*m_image).detachFromCSSValue(); 57 57 } 58 58 … … 61 61 detachPendingImage(); 62 62 63 if (is<StyleCachedImage Set>(m_imageSet.get()))64 downcast<StyleCachedImage Set>(*m_imageSet).clearImageSetValue();63 if (is<StyleCachedImage>(m_image.get())) 64 downcast<StyleCachedImage>(*m_image).detachFromCSSValue(); 65 65 } 66 66 … … 101 101 } 102 102 103 StyleCachedImage Set* CSSImageSetValue::cachedImageSet(CachedResourceLoader& loader, const ResourceLoaderOptions& options)103 StyleCachedImage* CSSImageSetValue::bestFitImage(CachedResourceLoader& loader, const ResourceLoaderOptions& options) 104 104 { 105 105 Document* document = loader.document(); … … 125 125 if (CachedResourceHandle<CachedImage> cachedImage = loader.requestImage(request)) { 126 126 detachPendingImage(); 127 m_image Set = StyleCachedImageSet::create(cachedImage.get(), image.scaleFactor,this);127 m_image = StyleCachedImage::createForImageSet(cachedImage.get(), image.scaleFactor, *this); 128 128 m_accessedBestFitImage = true; 129 129 } 130 130 } 131 131 132 return is<StyleCachedImage Set>(m_imageSet.get()) ? downcast<StyleCachedImageSet>(m_imageSet.get()) : nullptr;132 return is<StyleCachedImage>(m_image.get()) ? downcast<StyleCachedImage>(m_image.get()) : nullptr; 133 133 } 134 134 135 135 StyleImage* CSSImageSetValue::cachedOrPendingImageSet(const Document& document) 136 136 { 137 if (!m_image Set)138 m_image Set= StylePendingImage::create(this);139 else if (!m_image Set->isPendingImage()) {137 if (!m_image) 138 m_image = StylePendingImage::create(this); 139 else if (!m_image->isPendingImage()) { 140 140 float deviceScaleFactor = 1; 141 141 if (Page* page = document.page()) … … 145 145 if (deviceScaleFactor != m_scaleFactor) { 146 146 m_accessedBestFitImage = false; 147 m_image Set= StylePendingImage::create(this);147 m_image = StylePendingImage::create(this); 148 148 } 149 149 } 150 150 151 return m_image Set.get();151 return m_image.get(); 152 152 } 153 153 … … 184 184 bool CSSImageSetValue::traverseSubresources(const std::function<bool (const CachedResource&)>& handler) const 185 185 { 186 if (!is<StyleCachedImage Set>(m_imageSet.get()))186 if (!is<StyleCachedImage>(m_image.get())) 187 187 return false; 188 CachedImage* cachedResource = downcast<StyleCachedImage Set>(*m_imageSet).cachedImage();188 CachedImage* cachedResource = downcast<StyleCachedImage>(*m_image).cachedImage(); 189 189 ASSERT(cachedResource); 190 190 return handler(*cachedResource); -
trunk/Source/WebCore/css/CSSImageSetValue.h
r202656 r204560 35 35 class CachedResourceLoader; 36 36 class Document; 37 class StyleCachedImage Set;37 class StyleCachedImage; 38 38 class StyleImage; 39 39 struct ResourceLoaderOptions; … … 48 48 ~CSSImageSetValue(); 49 49 50 StyleCachedImage Set* cachedImageSet(CachedResourceLoader&, const ResourceLoaderOptions&);50 StyleCachedImage* bestFitImage(CachedResourceLoader&, const ResourceLoaderOptions&); 51 51 52 // Returns a StyleCachedImage Setif the best fit image has been cached already, otherwise a StylePendingImage.52 // Returns a StyleCachedImage if the best fit image has been cached already, otherwise a StylePendingImage. 53 53 StyleImage* cachedOrPendingImageSet(const Document&); 54 54 … … 77 77 static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale second) { return first.scaleFactor < second.scaleFactor; } 78 78 79 RefPtr<StyleImage> m_image Set;79 RefPtr<StyleImage> m_image; 80 80 bool m_accessedBestFitImage; 81 81 -
trunk/Source/WebCore/css/StyleResolver.cpp
r204455 r204560 155 155 #if ENABLE(CSS_IMAGE_SET) 156 156 #include "CSSImageSetValue.h" 157 #include "StyleCachedImageSet.h"158 157 #endif 159 158 -
trunk/Source/WebCore/page/EventHandler.cpp
r204466 r204560 103 103 #include <wtf/WeakPtr.h> 104 104 105 #if ENABLE(CSS_IMAGE_SET)106 #include "StyleCachedImageSet.h"107 #endif108 109 105 #if ENABLE(IOS_TOUCH_EVENTS) 110 106 #include "PlatformTouchEventIOS.h" -
trunk/Source/WebCore/rendering/style/ShapeValue.cpp
r202167 r204560 37 37 if (!image()) 38 38 return false; 39 if (image()->isCachedImage() || image()->isCachedImageSet())39 if (image()->isCachedImage()) 40 40 return image()->cachedImage() && image()->cachedImage()->hasImage(); 41 41 return image()->isGeneratedImage(); -
trunk/Source/WebCore/rendering/style/StyleAllInOne.cpp
r198207 r204560 42 42 #include "StyleBoxData.cpp" 43 43 #include "StyleCachedImage.cpp" 44 #include "StyleCachedImageSet.cpp"45 44 #include "StyleDeprecatedFlexibleBoxData.cpp" 46 45 #include "StyleFilterData.cpp" -
trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp
r191083 r204560 25 25 #include "StyleCachedImage.h" 26 26 27 #include "CSSImageSetValue.h" 27 28 #include "CachedImage.h" 28 29 #include "RenderElement.h" … … 30 31 namespace WebCore { 31 32 32 StyleCachedImage::StyleCachedImage(CachedImage* image )33 StyleCachedImage::StyleCachedImage(CachedImage* image, float scaleFactor, CSSImageSetValue* cssValue) 33 34 : m_image(image) 35 , m_scaleFactor(scaleFactor) 36 , m_cssImageSetValue(cssValue) 34 37 { 35 38 m_isCachedImage = true; … … 44 47 PassRefPtr<CSSValue> StyleCachedImage::cssValue() const 45 48 { 49 if (m_cssImageSetValue) 50 return const_cast<CSSImageSetValue*>(m_cssImageSetValue); 46 51 return CSSPrimitiveValue::create(m_image->url(), CSSPrimitiveValue::CSS_URI); 47 52 } … … 64 69 FloatSize StyleCachedImage::imageSize(const RenderElement* renderer, float multiplier) const 65 70 { 66 return m_image->imageSizeForRenderer(renderer, multiplier); 71 FloatSize size = m_image->imageSizeForRenderer(renderer, multiplier); 72 size.scale(1 / m_scaleFactor); 73 return size; 67 74 } 68 75 … … 107 114 } 108 115 116 float StyleCachedImage::imageScaleFactor() const 117 { 118 return m_scaleFactor; 119 } 120 109 121 bool StyleCachedImage::knownToBeOpaque(const RenderElement* renderer) const 110 122 { -
trunk/Source/WebCore/rendering/style/StyleCachedImage.h
r197563 r204560 31 31 namespace WebCore { 32 32 33 class CSSImageSetValue; 33 34 class CachedImage; 34 35 … … 36 37 WTF_MAKE_FAST_ALLOCATED; 37 38 public: 38 static Ref<StyleCachedImage> create(CachedImage* image) { return adoptRef(*new StyleCachedImage(image)); } 39 static Ref<StyleCachedImage> create(CachedImage* image) { return adoptRef(*new StyleCachedImage(image, 1, nullptr)); } 40 static Ref<StyleCachedImage> createForImageSet(CachedImage* image, float scaleFactor, CSSImageSetValue& cssValue) { return adoptRef(*new StyleCachedImage(image, scaleFactor, &cssValue)); } 39 41 virtual ~StyleCachedImage(); 40 42 41 43 CachedImage* cachedImage() const override { return m_image.get(); } 44 45 void detachFromCSSValue() { m_cssImageSetValue = nullptr; } 42 46 43 47 private: … … 58 62 void removeClient(RenderElement*) override; 59 63 RefPtr<Image> image(RenderElement*, const FloatSize&) const override; 64 float imageScaleFactor() const override; 60 65 bool knownToBeOpaque(const RenderElement*) const override; 61 66 62 explicit StyleCachedImage(CachedImage*);67 StyleCachedImage(CachedImage*, float scaleFactor, CSSImageSetValue*); 63 68 64 69 CachedResourceHandle<CachedImage> m_image; 70 float m_scaleFactor; 71 CSSImageSetValue* m_cssImageSetValue; // Not retained; it owns us. 65 72 }; 66 73 -
trunk/Source/WebCore/rendering/style/StyleImage.h
r191083 r204560 73 73 ALWAYS_INLINE bool isPendingImage() const { return m_isPendingImage; } 74 74 ALWAYS_INLINE bool isGeneratedImage() const { return m_isGeneratedImage; } 75 ALWAYS_INLINE bool isCachedImageSet() const { return m_isCachedImageSet; } 76 75 77 76 protected: 78 77 StyleImage() … … 80 79 , m_isPendingImage(false) 81 80 , m_isGeneratedImage(false) 82 , m_isCachedImageSet(false)83 81 { 84 82 } … … 86 84 bool m_isPendingImage : 1; 87 85 bool m_isGeneratedImage : 1; 88 bool m_isCachedImageSet : 1;89 86 }; 90 87 -
trunk/Source/WebCore/style/StylePendingResources.cpp
r204014 r204560 36 36 #include "SVGURIReference.h" 37 37 #include "StyleCachedImage.h" 38 #include "StyleCachedImageSet.h"39 38 #include "StyleGeneratedImage.h" 40 39 #include "StylePendingImage.h" … … 70 69 #if ENABLE(CSS_IMAGE_SET) 71 70 if (auto imageSetValue = pendingImage.cssImageSetValue()) 72 return imageSetValue-> cachedImageSet(document.cachedResourceLoader(), options);71 return imageSetValue->bestFitImage(document.cachedResourceLoader(), options); 73 72 #endif 74 73
Note: See TracChangeset
for help on using the changeset viewer.