OLD | NEW |
---|---|
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/fetch/ImageResource.h" | 25 #include "core/fetch/ImageResource.h" |
26 | 26 |
27 #include "core/fetch/ImageResourceClient.h" | 27 #include "core/fetch/ImageResourceClient.h" |
28 #include "core/fetch/MemoryCache.h" | 28 #include "core/fetch/MemoryCache.h" |
29 #include "core/fetch/ResourceClient.h" | 29 #include "core/fetch/ResourceClient.h" |
30 #include "core/fetch/ResourceClientWalker.h" | 30 #include "core/fetch/ResourceClientWalker.h" |
31 #include "core/fetch/ResourceFetcher.h" | 31 #include "core/fetch/ResourceFetcher.h" |
32 #include "core/fetch/ResourceLoader.h" | 32 #include "core/fetch/ResourceLoader.h" |
33 #include "core/html/HTMLImageElement.h" | |
34 #include "core/layout/LayoutObject.h" | 33 #include "core/layout/LayoutObject.h" |
35 #include "core/svg/graphics/SVGImage.h" | 34 #include "core/svg/graphics/SVGImage.h" |
36 #include "core/svg/graphics/SVGImageForContainer.h" | 35 #include "core/svg/graphics/SVGImageForContainer.h" |
37 #include "platform/Logging.h" | 36 #include "platform/Logging.h" |
38 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
39 #include "platform/SharedBuffer.h" | 38 #include "platform/SharedBuffer.h" |
40 #include "platform/TraceEvent.h" | 39 #include "platform/TraceEvent.h" |
41 #include "platform/graphics/BitmapImage.h" | 40 #include "platform/graphics/BitmapImage.h" |
42 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
43 #include "wtf/CurrentTime.h" | 42 #include "wtf/CurrentTime.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 | 204 |
206 if (m_image->isSVGImage()) { | 205 if (m_image->isSVGImage()) { |
207 blink::Image* image = svgImageForLayoutObject(layoutObject); | 206 blink::Image* image = svgImageForLayoutObject(layoutObject); |
208 if (image != blink::Image::nullImage()) | 207 if (image != blink::Image::nullImage()) |
209 return image; | 208 return image; |
210 } | 209 } |
211 | 210 |
212 return m_image.get(); | 211 return m_image.get(); |
213 } | 212 } |
214 | 213 |
215 void ImageResource::setContainerSizeForLayoutObject(const ImageResourceClient* l ayoutObject, const IntSize& containerSize, float containerZoom) | 214 void ImageResource::setContainerParametersForLayoutObject(const ImageResourceCli ent* layoutObject, const IntSize& containerSize, float containerZoom, const KURL & urlWithFragment) |
f(malita)
2015/09/08 18:41:19
Is the fragment not visible at the Resource level?
davve
2015/09/08 19:12:25
m_fragmentIdentifierForRequest is emptied on ::loa
f(malita)
2015/09/08 20:45:51
Yup, but I can't tell whether that part is needed/
davve
2015/09/09 14:22:53
Fwiw, on a simple test like
svg-resource-fragment-
| |
216 { | 215 { |
217 if (containerSize.isEmpty()) | 216 if (containerSize.isEmpty()) |
218 return; | 217 return; |
219 ASSERT(layoutObject); | 218 ASSERT(layoutObject); |
220 ASSERT(containerZoom); | 219 ASSERT(containerZoom); |
221 if (!m_image) | 220 if (!m_image) |
222 return; | 221 return; |
223 if (!m_image->isSVGImage()) { | 222 if (!m_image->isSVGImage()) { |
224 m_image->setContainerSize(containerSize); | 223 m_image->setContainerSize(containerSize); |
225 return; | 224 return; |
226 } | 225 } |
227 | 226 |
228 FloatSize containerSizeWithoutZoom(containerSize); | 227 FloatSize containerSizeWithoutZoom(containerSize); |
229 containerSizeWithoutZoom.scale(1 / containerZoom); | 228 containerSizeWithoutZoom.scale(1 / containerZoom); |
230 m_imageForContainerMap->set(layoutObject, SVGImageForContainer::create(toSVG Image(m_image.get()), containerSizeWithoutZoom, containerZoom)); | 229 m_imageForContainerMap->set(layoutObject, SVGImageForContainer::create(toSVG Image(m_image.get()), containerSizeWithoutZoom, containerZoom, urlWithFragment)) ; |
231 } | 230 } |
232 | 231 |
233 bool ImageResource::usesImageContainerSize() const | 232 bool ImageResource::usesImageContainerSize() const |
234 { | 233 { |
235 if (m_image) | 234 if (m_image) |
236 return m_image->usesContainerSize(); | 235 return m_image->usesContainerSize(); |
237 | 236 |
238 return false; | 237 return false; |
239 } | 238 } |
240 | 239 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 if (!layoutObject) | 517 if (!layoutObject) |
519 return Image::nullImage(); | 518 return Image::nullImage(); |
520 | 519 |
521 ImageForContainerMap::iterator it = m_imageForContainerMap->find(layoutObjec t); | 520 ImageForContainerMap::iterator it = m_imageForContainerMap->find(layoutObjec t); |
522 if (it == m_imageForContainerMap->end()) | 521 if (it == m_imageForContainerMap->end()) |
523 return Image::nullImage(); | 522 return Image::nullImage(); |
524 | 523 |
525 RefPtr<SVGImageForContainer> imageForContainer = it->value; | 524 RefPtr<SVGImageForContainer> imageForContainer = it->value; |
526 ASSERT(!imageForContainer->size().isEmpty()); | 525 ASSERT(!imageForContainer->size().isEmpty()); |
527 | 526 |
528 Node* node = layoutObject->node(); | |
529 if (node && isHTMLImageElement(node)) { | |
530 const AtomicString& urlString = toHTMLImageElement(node)->imageSourceURL (); | |
531 KURL url = node->document().completeURL(urlString); | |
532 imageForContainer->setURL(url); | |
533 } | |
534 | |
535 return imageForContainer.get(); | 527 return imageForContainer.get(); |
536 } | 528 } |
537 | 529 |
538 bool ImageResource::loadingMultipartContent() const | 530 bool ImageResource::loadingMultipartContent() const |
539 { | 531 { |
540 return m_loader && m_loader->loadingMultipartContent(); | 532 return m_loader && m_loader->loadingMultipartContent(); |
541 } | 533 } |
542 | 534 |
543 } // namespace blink | 535 } // namespace blink |
OLD | NEW |