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

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

Issue 1458083002: Support fragment URLs for more kinds of SVG images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplification wasn't simple enough Created 5 years, 1 month 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 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 #include "core/style/StyleFetchedImageSet.h" 27 #include "core/style/StyleFetchedImageSet.h"
28 28
29 #include "core/css/CSSImageSetValue.h" 29 #include "core/css/CSSImageSetValue.h"
30 #include "core/fetch/ImageResource.h" 30 #include "core/fetch/ImageResource.h"
31 #include "core/layout/LayoutObject.h" 31 #include "core/layout/LayoutObject.h"
32 #include "core/svg/graphics/SVGImageForContainer.h" 32 #include "core/svg/graphics/SVGImageForContainer.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal eFactor, CSSImageSetValue* value) 36 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal eFactor, CSSImageSetValue* value, const KURL& url)
37 : m_bestFitImage(image) 37 : m_bestFitImage(image)
38 , m_imageScaleFactor(imageScaleFactor) 38 , m_imageScaleFactor(imageScaleFactor)
39 , m_imageSetValue(value) 39 , m_imageSetValue(value)
40 , m_url(url)
40 { 41 {
41 m_isImageResourceSet = true; 42 m_isImageResourceSet = true;
42 m_bestFitImage->addClient(this); 43 m_bestFitImage->addClient(this);
43 } 44 }
44 45
45 46
46 StyleFetchedImageSet::~StyleFetchedImageSet() 47 StyleFetchedImageSet::~StyleFetchedImageSet()
47 { 48 {
48 m_bestFitImage->removeClient(this); 49 m_bestFitImage->removeClient(this);
49 } 50 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 118
118 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject) 119 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject)
119 { 120 {
120 m_bestFitImage->removeClient(layoutObject); 121 m_bestFitImage->removeClient(layoutObject);
121 } 122 }
122 123
123 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
124 { 125 {
125 RefPtr<Image> image = m_bestFitImage->image(); 126 RefPtr<Image> image = m_bestFitImage->image();
126 if (image && image->isSVGImage()) 127 if (image && image->isSVGImage())
127 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi ze, zoom); 128 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi ze, zoom, m_url);
128 return image; 129 return image;
129 } 130 }
130 131
131 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con st 132 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con st
132 { 133 {
133 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject); 134 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject);
134 } 135 }
135 136
136 DEFINE_TRACE(StyleFetchedImageSet) 137 DEFINE_TRACE(StyleFetchedImageSet)
137 { 138 {
138 visitor->trace(m_imageSetValue); 139 visitor->trace(m_imageSetValue);
139 StyleImage::trace(visitor); 140 StyleImage::trace(visitor);
140 } 141 }
141 142
142 } // namespace blink 143 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImageSet.h ('k') | third_party/WebKit/Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698