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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleFetchedImage.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: Simplifications and an added content test 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) 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 14 matching lines...) Expand all
25 #include "core/style/StyleFetchedImage.h" 25 #include "core/style/StyleFetchedImage.h"
26 26
27 #include "core/css/CSSImageValue.h" 27 #include "core/css/CSSImageValue.h"
28 #include "core/fetch/ImageResource.h" 28 #include "core/fetch/ImageResource.h"
29 #include "core/layout/LayoutObject.h" 29 #include "core/layout/LayoutObject.h"
30 #include "core/svg/graphics/SVGImage.h" 30 #include "core/svg/graphics/SVGImage.h"
31 #include "core/svg/graphics/SVGImageForContainer.h" 31 #include "core/svg/graphics/SVGImageForContainer.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 StyleFetchedImage::StyleFetchedImage(ImageResource* image, Document* document) 35 StyleFetchedImage::StyleFetchedImage(ImageResource* image, Document* document, c onst KURL& url)
36 : m_image(image) 36 : m_image(image)
37 , m_document(document) 37 , m_document(document)
38 , m_url(url)
38 { 39 {
39 m_isImageResource = true; 40 m_isImageResource = true;
40 m_image->addClient(this); 41 m_image->addClient(this);
41 } 42 }
42 43
43 StyleFetchedImage::~StyleFetchedImage() 44 StyleFetchedImage::~StyleFetchedImage()
44 { 45 {
45 m_image->removeClient(this); 46 m_image->removeClient(this);
46 } 47 }
47 48
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (m_document && m_image && m_image->image() && m_image->image()->isSVGImag e()) 121 if (m_document && m_image && m_image->image() && m_image->image()->isSVGImag e())
121 toSVGImage(m_image->image())->updateUseCounters(*m_document); 122 toSVGImage(m_image->image())->updateUseCounters(*m_document);
122 // Oilpan: do not prolong the Document's lifetime. 123 // Oilpan: do not prolong the Document's lifetime.
123 m_document.clear(); 124 m_document.clear();
124 } 125 }
125 126
126 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject*, const IntSize& c ontainerSize, float zoom) const 127 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject*, const IntSize& c ontainerSize, float zoom) const
127 { 128 {
128 RefPtr<Image> image = m_image->image(); 129 RefPtr<Image> image = m_image->image();
129 if (image->isSVGImage()) 130 if (image->isSVGImage())
130 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi ze, zoom); 131 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi ze, zoom, m_url);
131 return image; 132 return image;
132 } 133 }
133 134
134 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const 135 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const
135 { 136 {
136 return m_image->currentFrameKnownToBeOpaque(layoutObject); 137 return m_image->currentFrameKnownToBeOpaque(layoutObject);
137 } 138 }
138 139
139 DEFINE_TRACE(StyleFetchedImage) 140 DEFINE_TRACE(StyleFetchedImage)
140 { 141 {
141 visitor->trace(m_document); 142 visitor->trace(m_document);
142 StyleImage::trace(visitor); 143 StyleImage::trace(visitor);
143 } 144 }
144 145
145 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698