Source/WebCore/ChangeLog

 12017-08-23 Said Abou-Hallawa <sabouhallawa@apple.com>
 2
 3 The SVG fragment identifier is not respected if it is a part of an HTTP URL
 4 https://bugs.webkit.org/show_bug.cgi?id=163811
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 If an image is referenced more than once in a page and the URL to that
 9 image is an HTTP URL, one CachedImage is created for all the renderers
 10 even if the original URLs have different fragmentIdentifiers. In this
 11 case the fragment will be removed from the request which is associated
 12 with the shared CachedImage. This CachedImage creates an SVGImage with
 13 a URL but without a fragmentIdentifier. So SVGImage::draw() does not call
 14 FrameView::scrollToFragment() and therefore the viewport is not setup
 15 correctly for displaying the SVG in this case.
 16
 17 The fix is to move the url from the SVGImage to SVGImageForContainer.
 18 Because there is one SVGImageForContainer created for every renderer,
 19 we can move the full URL there. The drawing of an SVGImage has to start
 20 from the SVGImageForContainer::draw() because the SVGImage may not have
 21 an intrinsic size and the SVGImageForContainer is the one which knows
 22 the destination rectangle. So SVGImageForContainer can pass the full url
 23 to SVGImage::drawForContainer() which can be used to scrollToFragment()
 24 before calling SVGImage::draw().
 25
 26 For clarity and consistency, all setContainerSizeForRenderer() will be
 27 changed to setContainerContext() and the pair SizeAndZoom will be replaced
 28 by the struct ContainerContext.
 29
 30 Tests: http/tests/svg/svg-fragment-background.html
 31 http/tests/svg/svg-fragment-image.html
 32
 33 * css/CSSCursorImageValue.h:
 34 * css/CSSImageSetValue.cpp:
 35 (WebCore::CSSImageSetValue::url):
 36 * css/CSSImageSetValue.h:
 37 * loader/cache/CachedImage.cpp:
 38 (WebCore::CachedImage::didRemoveClient):
 39 (WebCore::CachedImage::switchClientsToRevalidatedResource):
 40 (WebCore::CachedImage::allClientsRemoved):
 41 (WebCore::CachedImage::setContainerContextForClient):
 42 (WebCore::CachedImage::clear):
 43 (WebCore::CachedImage::createImage):
 44 (WebCore::CachedImage::setContainerSizeForRenderer): Deleted.
 45 * loader/cache/CachedImage.h:
 46 * rendering/RenderBoxModelObject.cpp:
 47 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry const):
 48 (WebCore::RenderBoxModelObject::paintNinePieceImage):
 49 * rendering/RenderImage.cpp:
 50 (WebCore::RenderImage::updateInnerContentRect):
 51 (WebCore::RenderImage::repaintOrMarkForLayout):
 52 * rendering/RenderImageResource.cpp:
 53 (WebCore::RenderImageResource::setContainerContext):
 54 (WebCore::RenderImageResource::setContainerSizeForRenderer): Deleted.
 55 * rendering/RenderImageResource.h:
 56 * rendering/RenderImageResourceStyleImage.cpp:
 57 (WebCore::RenderImageResourceStyleImage::setContainerContext):
 58 (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer): Deleted.
 59 * rendering/RenderImageResourceStyleImage.h:
 60 * rendering/RenderListMarker.cpp:
 61 (WebCore::RenderListMarker::updateContent):
 62 * rendering/shapes/ShapeOutsideInfo.cpp:
 63 (WebCore::ShapeOutsideInfo::createShapeForImage const):
 64 * rendering/style/StyleCachedImage.cpp:
 65 (WebCore::StyleCachedImage::imageSourceURL):
 66 (WebCore::StyleCachedImage::setContainerContextForRenderer):
 67 (WebCore::StyleCachedImage::setContainerSizeForRenderer): Deleted.
 68 * rendering/style/StyleCachedImage.h:
 69 * rendering/style/StyleGeneratedImage.h:
 70 * rendering/style/StyleImage.h:
 71 * rendering/svg/RenderSVGImage.cpp:
 72 (WebCore::RenderSVGImage::updateImageViewport):
 73 * svg/SVGImageElement.h:
 74 * svg/graphics/SVGImage.cpp:
 75 (WebCore::SVGImage::SVGImage):
 76 (WebCore::SVGImage::drawForContainer):
 77 (WebCore::SVGImage::drawPatternForContainer):
 78 (WebCore::SVGImage::draw):
 79 (WebCore::SVGImage::dump const): Deleted.
 80 * svg/graphics/SVGImage.h:
 81 * svg/graphics/SVGImageCache.cpp:
 82 (WebCore::SVGImageCache::setContainerContextForClient):
 83 (WebCore::SVGImageCache::setContainerSizeForRenderer): Deleted.
 84 * svg/graphics/SVGImageCache.h:
 85 * svg/graphics/SVGImageForContainer.cpp:
 86 (WebCore::SVGImageForContainer::size const):
 87 (WebCore::SVGImageForContainer::draw):
 88 (WebCore::SVGImageForContainer::drawPattern):
 89 * svg/graphics/SVGImageForContainer.h:
 90
1912017-08-28 Carlos Alberto Lopez Perez <clopez@igalia.com>
292
393 [GTK] [WPE] Rename EventHandlerGlib to EventHandlerGLib
221268

Source/WebCore/css/CSSCursorImageValue.h

@@public:
5252 return IntPoint(-1, -1);
5353 }
5454
 55 URL url() const { return m_originalURL; }
 56
5557 String customCSSText() const;
5658
5759 std::pair<CachedImage*, float> loadImage(CachedResourceLoader&, const ResourceLoaderOptions&);
221268

Source/WebCore/css/CSSImageSetValue.cpp

@@CSSImageSetValue::ImageWithScale CSSImag
8686 return image;
8787}
8888
 89URL CSSImageSetValue::url(Document& document)
 90{
 91 return document.completeURL(bestImageForScaleFactor().imageURL);
 92}
 93
8994std::pair<CachedImage*, float> CSSImageSetValue::loadBestFitImage(CachedResourceLoader& loader, const ResourceLoaderOptions& options)
9095{
9196 Document* document = loader.document();

@@std::pair<CachedImage*, float> CSSImageS
99104 // FIXME: In the future, we want to take much more than deviceScaleFactor into acount here.
100105 // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(),
101106 // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
102  ImageWithScale image = bestImageForScaleFactor();
103  CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), options);
 107 CachedResourceRequest request(ResourceRequest(url(*document)), options);
104108 request.setInitiator(cachedResourceRequestInitiators().css);
105109 if (options.mode == FetchOptions::Mode::Cors)
106110 request.updateForAccessControl(*document);
107111
108112 m_cachedImage = loader.requestImage(WTFMove(request)).valueOr(nullptr);
109  m_bestFitImageScaleFactor = image.scaleFactor;
 113 m_bestFitImageScaleFactor = bestImageForScaleFactor().scaleFactor;
110114 }
111115 return { m_cachedImage.get(), m_bestFitImageScaleFactor };
112116}
221268

Source/WebCore/css/CSSImageSetValue.h

@@public:
5858
5959 void updateDeviceScaleFactor(const Document&);
6060
 61 URL url(Document&);
 62
6163protected:
6264 ImageWithScale bestImageForScaleFactor();
6365
221268

Source/WebCore/loader/cache/CachedImage.cpp

@@void CachedImage::didRemoveClient(Cached
129129{
130130 ASSERT(client.resourceClientType() == CachedImageClient::expectedType());
131131
132  m_pendingContainerSizeRequests.remove(&static_cast<CachedImageClient&>(client));
 132 m_pendingContainerContextRequests.remove(&static_cast<CachedImageClient&>(client));
133133 m_pendingImageDrawingClients.remove(&static_cast<CachedImageClient&>(client));
134134
135135 if (m_svgImageCache)

@@void CachedImage::switchClientsToRevalid
163163{
164164 ASSERT(is<CachedImage>(resourceToRevalidate()));
165165 // Pending container size requests need to be transferred to the revalidated resource.
166  if (!m_pendingContainerSizeRequests.isEmpty()) {
 166 if (!m_pendingContainerContextRequests.isEmpty()) {
167167 // A copy of pending size requests is needed as they are deleted during CachedResource::switchClientsToRevalidateResouce().
168  ContainerSizeRequests switchContainerSizeRequests;
169  for (auto& request : m_pendingContainerSizeRequests)
170  switchContainerSizeRequests.set(request.key, request.value);
 168 ContainerContextRequests switchContainerContextRequests;
 169 for (auto& request : m_pendingContainerContextRequests)
 170 switchContainerContextRequests.set(request.key, request.value);
171171 CachedResource::switchClientsToRevalidatedResource();
172172 CachedImage& revalidatedCachedImage = downcast<CachedImage>(*resourceToRevalidate());
173  for (auto& request : switchContainerSizeRequests)
174  revalidatedCachedImage.setContainerSizeForRenderer(request.key, request.value.first, request.value.second);
 173 for (auto& request : switchContainerContextRequests)
 174 revalidatedCachedImage.setContainerContextForClient(request.key, request.value.containerSize, request.value.containerZoom, request.value.sourceURL);
175175 return;
176176 }
177177

@@void CachedImage::switchClientsToRevalid
180180
181181void CachedImage::allClientsRemoved()
182182{
183  m_pendingContainerSizeRequests.clear();
 183 m_pendingContainerContextRequests.clear();
184184 m_pendingImageDrawingClients.clear();
185185 if (m_image && !errorOccurred())
186186 m_image->resetAnimation();

@@Image* CachedImage::imageForRenderer(con
242242 return m_image.get();
243243}
244244
245 void CachedImage::setContainerSizeForRenderer(const CachedImageClient* renderer, const LayoutSize& containerSize, float containerZoom)
 245void CachedImage::setContainerContextForClient(const CachedImageClient* client, const LayoutSize& containerSize, float containerZoom, const URL& sourceURL)
246246{
247247 if (containerSize.isEmpty())
248248 return;
249  ASSERT(renderer);
 249 ASSERT(client);
250250 ASSERT(containerZoom);
251251 if (!m_image) {
252  m_pendingContainerSizeRequests.set(renderer, SizeAndZoom(containerSize, containerZoom));
 252 ContainerContext containerContext = { containerSize, containerZoom, sourceURL };
 253 m_pendingContainerContextRequests.set(client, containerContext);
253254 return;
254255 }
255256

@@void CachedImage::setContainerSizeForRen
258259 return;
259260 }
260261
261  m_svgImageCache->setContainerSizeForRenderer(renderer, containerSize, containerZoom);
 262 m_svgImageCache->setContainerContextForClient(client, containerSize, containerZoom, sourceURL);
262263}
263264
264265LayoutSize CachedImage::imageSizeForRenderer(const RenderElement* renderer, float multiplier, SizeType sizeType)

@@void CachedImage::clear()
313314{
314315 destroyDecodedData();
315316 clearImage();
316  m_pendingContainerSizeRequests.clear();
 317 m_pendingContainerContextRequests.clear();
317318 m_pendingImageDrawingClients.clear();
318319 setEncodedSize(0);
319320}

@@inline void CachedImage::createImage()
327328 m_imageObserver = CachedImageObserver::create(*this);
328329
329330 if (m_response.mimeType() == "image/svg+xml") {
330  auto svgImage = SVGImage::create(*m_imageObserver, url());
 331 auto svgImage = SVGImage::create(*m_imageObserver);
331332 m_svgImageCache = std::make_unique<SVGImageCache>(svgImage.ptr());
332333 m_image = WTFMove(svgImage);
333334#if USE(CG) && !USE(WEBKIT_IMAGE_DECODERS)

@@inline void CachedImage::createImage()
340341 if (m_image) {
341342 // Send queued container size requests.
342343 if (m_image->usesContainerSize()) {
343  for (auto& request : m_pendingContainerSizeRequests)
344  setContainerSizeForRenderer(request.key, request.value.first, request.value.second);
 344 for (auto& request : m_pendingContainerContextRequests)
 345 setContainerContextForClient(request.key, request.value.containerSize, request.value.containerZoom, request.value.sourceURL);
345346 }
346  m_pendingContainerSizeRequests.clear();
 347 m_pendingContainerContextRequests.clear();
347348 m_pendingImageDrawingClients.clear();
348349 }
349350}
221268

Source/WebCore/loader/cache/CachedImage.h

@@public:
6363
6464 bool canRender(const RenderElement* renderer, float multiplier) { return !errorOccurred() && !imageSizeForRenderer(renderer, multiplier).isEmpty(); }
6565
66  void setContainerSizeForRenderer(const CachedImageClient*, const LayoutSize&, float);
 66 void setContainerContextForClient(const CachedImageClient*, const LayoutSize&, float, const URL&);
6767 bool usesImageContainerSize() const { return m_image && m_image->usesContainerSize(); }
6868 bool imageHasRelativeWidth() const { return m_image && m_image->hasRelativeWidth(); }
6969 bool imageHasRelativeHeight() const { return m_image && m_image->hasRelativeHeight(); }

@@private:
150150
151151 void didReplaceSharedBufferContents() override;
152152
153  typedef std::pair<LayoutSize, float> SizeAndZoom;
154  typedef HashMap<const CachedImageClient*, SizeAndZoom> ContainerSizeRequests;
155  ContainerSizeRequests m_pendingContainerSizeRequests;
 153 struct ContainerContext {
 154 LayoutSize containerSize;
 155 float containerZoom;
 156 URL sourceURL;
 157 };
 158
 159 typedef HashMap<const CachedImageClient*, ContainerContext> ContainerContextRequests;
 160 ContainerContextRequests m_pendingContainerContextRequests;
156161
157162 HashSet<CachedImageClient*> m_pendingImageDrawingClients;
158163
221268

Source/WebCore/rendering/RenderBoxModelObject.cpp

@@BackgroundImageGeometry RenderBoxModelOb
12411241 auto clientForBackgroundImage = backgroundObject ? backgroundObject : this;
12421242 LayoutSize tileSize = calculateFillTileSize(fillLayer, positioningAreaSize);
12431243 if (StyleImage* layerImage = fillLayer.image())
1244  layerImage->setContainerSizeForRenderer(clientForBackgroundImage, tileSize, style().effectiveZoom());
 1244 layerImage->setContainerContextForRenderer(clientForBackgroundImage, tileSize, style().effectiveZoom());
12451245
12461246 EFillRepeat backgroundRepeatX = fillLayer.repeatX();
12471247 EFillRepeat backgroundRepeatY = fillLayer.repeatY();

@@bool RenderBoxModelObject::paintNinePiec
13631363 LayoutSize source = calculateImageIntrinsicDimensions(styleImage, destination.size(), DoNotScaleByEffectiveZoom);
13641364
13651365 // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any.
1366  styleImage->setContainerSizeForRenderer(this, source, style.effectiveZoom());
 1366 styleImage->setContainerContextForRenderer(this, source, style.effectiveZoom());
13671367
13681368 ninePieceImage.paint(graphicsContext, this, style, destination, source, deviceScaleFactor, op);
13691369 return true;
221268

Source/WebCore/rendering/RenderImage.cpp

@@void RenderImage::updateInnerContentRect
285285{
286286 // Propagate container size to image resource.
287287 IntSize containerSize(replacedContentRect(intrinsicSize()).size());
288  if (!containerSize.isEmpty())
289  imageResource().setContainerSizeForRenderer(containerSize);
 288 if (!containerSize.isEmpty()) {
 289 URL url;
 290 if (HTMLImageElement* imageElement = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr)
 291 url = document().completeURL(imageElement->imageSourceURL());
 292 imageResource().setContainerContext(containerSize, url);
 293 }
290294}
291295
292296void RenderImage::repaintOrMarkForLayout(ImageSizeChangeType imageSizeChange, const IntRect* rect)

@@void RenderImage::repaintOrMarkForLayout
323327 // may need values from the containing block, though, so make sure that we're not too
324328 // early. It may be that layout hasn't even taken place once yet.
325329
326  // FIXME: we should not have to trigger another call to setContainerSizeForRenderer()
 330 // FIXME: we should not have to trigger another call to setContainerContextForRenderer()
327331 // from here, since it's already being done during layout.
328332 updateInnerContentRect();
329333 }
221268

Source/WebCore/rendering/RenderImageResource.cpp

@@RefPtr<Image> RenderImageResource::image
9494 return &Image::nullImage();
9595}
9696
97 void RenderImageResource::setContainerSizeForRenderer(const IntSize& imageContainerSize)
 97void RenderImageResource::setContainerContext(const IntSize& imageContainerSize, const URL& sourceURL)
9898{
9999 if (!m_cachedImage)
100100 return;
101101 ASSERT(m_renderer);
102  m_cachedImage->setContainerSizeForRenderer(m_renderer, imageContainerSize, m_renderer->style().effectiveZoom());
 102 m_cachedImage->setContainerContextForClient(m_renderer, imageContainerSize, m_renderer->style().effectiveZoom(), sourceURL);
103103}
104104
105105LayoutSize RenderImageResource::imageSize(float multiplier, CachedImage::SizeType type) const
221268

Source/WebCore/rendering/RenderImageResource.h

@@public:
5151 virtual RefPtr<Image> image(const IntSize& size = { }) const;
5252 virtual bool errorOccurred() const { return m_cachedImage && m_cachedImage->errorOccurred(); }
5353
54  virtual void setContainerSizeForRenderer(const IntSize&);
 54 virtual void setContainerContext(const IntSize&, const URL&);
5555
5656 virtual bool imageHasRelativeWidth() const { return m_cachedImage && m_cachedImage->imageHasRelativeWidth(); }
5757 virtual bool imageHasRelativeHeight() const { return m_cachedImage && m_cachedImage->imageHasRelativeHeight(); }
221268

Source/WebCore/rendering/RenderImageResourceStyleImage.cpp

@@RefPtr<Image> RenderImageResourceStyleIm
6262 return &Image::nullImage();
6363}
6464
65 void RenderImageResourceStyleImage::setContainerSizeForRenderer(const IntSize& size)
 65void RenderImageResourceStyleImage::setContainerContext(const IntSize& size, const URL&)
6666{
6767 ASSERT(renderer());
68  m_styleImage->setContainerSizeForRenderer(renderer(), size, renderer()->style().effectiveZoom());
 68 m_styleImage->setContainerContextForRenderer(renderer(), size, renderer()->style().effectiveZoom());
6969}
7070
7171} // namespace WebCore
221268

Source/WebCore/rendering/RenderImageResourceStyleImage.h

@@private:
4444 RefPtr<Image> image(const IntSize& = { }) const final;
4545 bool errorOccurred() const final { return m_styleImage->errorOccurred(); }
4646
47  void setContainerSizeForRenderer(const IntSize&) final;
 47 void setContainerContext(const IntSize&, const URL&) final;
4848
4949 bool imageHasRelativeWidth() const final { return m_styleImage->imageHasRelativeWidth(); }
5050 bool imageHasRelativeHeight() const final { return m_styleImage->imageHasRelativeHeight(); }
221268

Source/WebCore/rendering/RenderListMarker.cpp

@@void RenderListMarker::updateContent()
14431443 LayoutUnit bulletWidth = style().fontMetrics().ascent() / LayoutUnit(2);
14441444 LayoutSize defaultBulletSize(bulletWidth, bulletWidth);
14451445 LayoutSize imageSize = calculateImageIntrinsicDimensions(m_image.get(), defaultBulletSize, DoNotScaleByEffectiveZoom);
1446  m_image->setContainerSizeForRenderer(this, imageSize, style().effectiveZoom());
 1446 m_image->setContainerContextForRenderer(this, imageSize, style().effectiveZoom());
14471447 return;
14481448 }
14491449
221268

Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

@@static LayoutRect getShapeImageMarginRec
147147std::unique_ptr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const
148148{
149149 LayoutSize imageSize = m_renderer.calculateImageIntrinsicDimensions(styleImage, m_referenceBoxLogicalSize, RenderImage::ScaleByEffectiveZoom);
150  styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.style().effectiveZoom());
 150 styleImage->setContainerContextForRenderer(&m_renderer, imageSize, m_renderer.style().effectiveZoom());
151151
152152 const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referenceBoxLogicalSize);
153153 const LayoutRect& imageRect = is<RenderImage>(m_renderer)
221268

Source/WebCore/rendering/style/StyleCachedImage.cpp

@@bool StyleCachedImage::operator==(const
6868 return false;
6969}
7070
 71URL StyleCachedImage::imageSourceURL(Document& document)
 72{
 73 if (is<CSSImageValue>(m_cssValue)) {
 74 auto& imageValue = downcast<CSSImageValue>(m_cssValue.get());
 75 return imageValue.url();
 76 }
 77
 78 if (is<CSSImageSetValue>(m_cssValue)) {
 79 auto& imageSetValue = downcast<CSSImageSetValue>(m_cssValue.get());
 80 return imageSetValue.url(document);
 81 }
 82
 83 if (is<CSSCursorImageValue>(m_cssValue.get())) {
 84 auto& cursorValue = downcast<CSSCursorImageValue>(m_cssValue.get());
 85 return cursorValue.url();
 86 }
 87
 88 ASSERT_NOT_REACHED();
 89 return URL();
 90}
 91
7192void StyleCachedImage::load(CachedResourceLoader& loader, const ResourceLoaderOptions& options)
7293{
7394 ASSERT(m_isPending);

@@bool StyleCachedImage::usesImageContaine
165186 return m_cachedImage->usesImageContainerSize();
166187}
167188
168 void StyleCachedImage::setContainerSizeForRenderer(const RenderElement* renderer, const FloatSize& imageContainerSize, float imageContainerZoomFactor)
 189void StyleCachedImage::setContainerContextForRenderer(const RenderElement* renderer, const FloatSize& containerSize, float containerZoom)
169190{
170191 if (!m_cachedImage)
171192 return;
172  m_cachedImage->setContainerSizeForRenderer(renderer, LayoutSize(imageContainerSize), imageContainerZoomFactor);
 193 ASSERT(renderer);
 194 m_cachedImage->setContainerContextForClient(renderer, LayoutSize(containerSize), containerZoom, imageSourceURL(renderer->document()));
173195}
174196
175197void StyleCachedImage::addClient(RenderElement* renderer)
221268

Source/WebCore/rendering/style/StyleCachedImage.h

@@public:
3838 static Ref<StyleCachedImage> create(CSSValue& cssValue) { return adoptRef(*new StyleCachedImage(cssValue)); }
3939 virtual ~StyleCachedImage();
4040
41  bool operator==(const StyleImage& other) const override;
 41 bool operator==(const StyleImage& other) const final;
4242
43  CachedImage* cachedImage() const override;
 43 CachedImage* cachedImage() const final;
4444
45  WrappedImagePtr data() const override { return m_cachedImage.get(); }
 45 WrappedImagePtr data() const final { return m_cachedImage.get(); }
4646
47  Ref<CSSValue> cssValue() const override;
 47 Ref<CSSValue> cssValue() const final;
4848
49  bool canRender(const RenderElement*, float multiplier) const override;
50  bool isPending() const override;
51  void load(CachedResourceLoader&, const ResourceLoaderOptions&) override;
52  bool isLoaded() const override;
53  bool errorOccurred() const override;
54  FloatSize imageSize(const RenderElement*, float multiplier) const override;
55  bool imageHasRelativeWidth() const override;
56  bool imageHasRelativeHeight() const override;
57  void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
58  bool usesImageContainerSize() const override;
59  void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) override;
60  void addClient(RenderElement*) override;
61  void removeClient(RenderElement*) override;
62  RefPtr<Image> image(RenderElement*, const FloatSize&) const override;
63  float imageScaleFactor() const override;
64  bool knownToBeOpaque(const RenderElement*) const override;
 49 bool canRender(const RenderElement*, float multiplier) const final;
 50 bool isPending() const final;
 51 void load(CachedResourceLoader&, const ResourceLoaderOptions&) final;
 52 bool isLoaded() const final;
 53 bool errorOccurred() const final;
 54 FloatSize imageSize(const RenderElement*, float multiplier) const final;
 55 bool imageHasRelativeWidth() const final;
 56 bool imageHasRelativeHeight() const final;
 57 void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) final;
 58 bool usesImageContainerSize() const final;
 59 void setContainerContextForRenderer(const RenderElement*, const FloatSize&, float) final;
 60 void addClient(RenderElement*) final;
 61 void removeClient(RenderElement*) final;
 62 RefPtr<Image> image(RenderElement*, const FloatSize&) const final;
 63 float imageScaleFactor() const final;
 64 bool knownToBeOpaque(const RenderElement*) const final;
6565
6666private:
6767 StyleCachedImage(CSSValue&);
 68 URL imageSourceURL(Document&);
6869
6970 Ref<CSSValue> m_cssValue;
7071 bool m_isPending { true };
221268

Source/WebCore/rendering/style/StyleGeneratedImage.h

@@public:
4040 CSSImageGeneratorValue& imageValue() { return m_imageGeneratorValue; }
4141
4242private:
43  bool operator==(const StyleImage& other) const override { return data() == other.data(); }
 43 bool operator==(const StyleImage& other) const final { return data() == other.data(); }
4444
45  WrappedImagePtr data() const override { return m_imageGeneratorValue.ptr(); }
 45 WrappedImagePtr data() const final { return m_imageGeneratorValue.ptr(); }
4646
47  Ref<CSSValue> cssValue() const override;
 47 Ref<CSSValue> cssValue() const final;
4848
4949 bool isPending() const override;
50  void load(CachedResourceLoader&, const ResourceLoaderOptions&) override;
51  FloatSize imageSize(const RenderElement*, float multiplier) const override;
52  bool imageHasRelativeWidth() const override { return !m_fixedSize; }
53  bool imageHasRelativeHeight() const override { return !m_fixedSize; }
54  void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
55  bool usesImageContainerSize() const override { return !m_fixedSize; }
56  void setContainerSizeForRenderer(const RenderElement*, const FloatSize& containerSize, float) override { m_containerSize = containerSize; }
57  void addClient(RenderElement*) override;
58  void removeClient(RenderElement*) override;
59  RefPtr<Image> image(RenderElement*, const FloatSize&) const override;
60  bool knownToBeOpaque(const RenderElement*) const override;
 50 void load(CachedResourceLoader&, const ResourceLoaderOptions&) final;
 51 FloatSize imageSize(const RenderElement*, float multiplier) const final;
 52 bool imageHasRelativeWidth() const final { return !m_fixedSize; }
 53 bool imageHasRelativeHeight() const final { return !m_fixedSize; }
 54 void computeIntrinsicDimensions(const RenderElement*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) final;
 55 bool usesImageContainerSize() const final { return !m_fixedSize; }
 56 void setContainerContextForRenderer(const RenderElement*, const FloatSize& containerSize, float) final { m_containerSize = containerSize; }
 57 void addClient(RenderElement*) final;
 58 void removeClient(RenderElement*) final;
 59 RefPtr<Image> image(RenderElement*, const FloatSize&) const final;
 60 bool knownToBeOpaque(const RenderElement*) const final;
6161
6262 explicit StyleGeneratedImage(Ref<CSSImageGeneratorValue>&&);
6363
221268

Source/WebCore/rendering/style/StyleImage.h

@@public:
5959 virtual bool imageHasRelativeWidth() const = 0;
6060 virtual bool imageHasRelativeHeight() const = 0;
6161 virtual bool usesImageContainerSize() const = 0;
62  virtual void setContainerSizeForRenderer(const RenderElement*, const FloatSize&, float) = 0;
 62 virtual void setContainerContextForRenderer(const RenderElement*, const FloatSize&, float) = 0;
6363 virtual void addClient(RenderElement*) = 0;
6464 virtual void removeClient(RenderElement*) = 0;
6565 virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const = 0;
221268

Source/WebCore/rendering/svg/RenderSVGImage.cpp

@@bool RenderSVGImage::updateImageViewport
7575 SVGLengthContext lengthContext(&imageElement());
7676 m_objectBoundingBox = FloatRect(imageElement().x().value(lengthContext), imageElement().y().value(lengthContext), imageElement().width().value(lengthContext), imageElement().height().value(lengthContext));
7777
 78 URL url = document().completeURL(imageElement().imageSourceURL());
 79
7880 // Images with preserveAspectRatio=none should force non-uniform scaling. This can be achieved
7981 // by setting the image's container size to its intrinsic size.
8082 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRatio’ attribute.
8183 if (imageElement().preserveAspectRatio().align() == SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_NONE) {
8284 if (CachedImage* cachedImage = imageResource().cachedImage()) {
83  LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(0, style().effectiveZoom());
 85 LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(nullptr, style().effectiveZoom());
8486 if (intrinsicSize != imageResource().imageSize(style().effectiveZoom())) {
85  imageResource().setContainerSizeForRenderer(roundedIntSize(intrinsicSize));
 87 imageResource().setContainerContext(roundedIntSize(intrinsicSize), url);
8688 updatedViewport = true;
8789 }
8890 }

@@bool RenderSVGImage::updateImageViewport
9092
9193 if (oldBoundaries != m_objectBoundingBox) {
9294 if (!updatedViewport)
93  imageResource().setContainerSizeForRenderer(enclosingIntRect(m_objectBoundingBox).size());
 95 imageResource().setContainerContext(enclosingIntRect(m_objectBoundingBox).size(), url);
9496 updatedViewport = true;
9597 m_needsBoundariesUpdate = true;
9698 }
221268

Source/WebCore/svg/SVGImageElement.h

@@public:
3737 static Ref<SVGImageElement> create(const QualifiedName&, Document&);
3838
3939 bool hasSingleSecurityOrigin() const;
 40 const AtomicString& imageSourceURL() const final;
4041
4142private:
4243 SVGImageElement(const QualifiedName&, Document&);

@@private:
5253
5354 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
5455
55  const AtomicString& imageSourceURL() const final;
5656 void addSubresourceAttributeURLs(ListHashSet<URL>&) const final;
5757
5858 bool haveLoadedRequiredResources() final;
221268

Source/WebCore/svg/graphics/SVGImage.cpp

6666
6767namespace WebCore {
6868
69 SVGImage::SVGImage(ImageObserver& observer, const URL& url)
 69SVGImage::SVGImage(ImageObserver& observer)
7070 : Image(&observer)
71  , m_url(url)
7271{
7372}
7473

@@IntSize SVGImage::containerSize() const
166165 return IntSize(300, 150);
167166}
168167
169 ImageDrawResult SVGImage::drawForContainer(GraphicsContext& context, const FloatSize containerSize, float zoom, const FloatRect& dstRect,
 168ImageDrawResult SVGImage::drawForContainer(GraphicsContext& context, const FloatSize containerSize, float containerZoom, const URL& sourceURL, const FloatRect& dstRect,
170169 const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode)
171170{
172171 if (!m_page)

@@ImageDrawResult SVGImage::drawForContain
182181 setContainerSize(roundedContainerSize);
183182
184183 FloatRect scaledSrc = srcRect;
185  scaledSrc.scale(1 / zoom);
 184 scaledSrc.scale(1 / containerZoom);
186185
187186 // Compensate for the container size rounding by adjusting the source rect.
188187 FloatSize adjustedSrcSize = scaledSrc.size();
189188 adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(), roundedContainerSize.height() / containerSize.height());
190189 scaledSrc.setSize(adjustedSrcSize);
191190
 191 if (!sourceURL.isEmpty()) {
 192 FrameView* view = frameView();
 193 ASSERT(view);
 194 view->scrollToFragment(sourceURL);
 195 }
 196
192197 ImageDrawResult result = draw(context, dstRect, scaledSrc, compositeOp, blendMode, DecodingMode::Synchronous, ImageOrientationDescription());
193198
194199 setImageObserver(observer);

@@NativeImagePtr SVGImage::nativeImage(con
242247}
243248#endif
244249
245 void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize& containerSize, float zoom, const FloatRect& srcRect,
 250void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize& containerSize, float containerZoom, const URL& sourceURL, const FloatRect& srcRect,
246251 const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
247252{
248253 FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize);
249  zoomedContainerRect.scale(zoom);
 254 zoomedContainerRect.scale(containerZoom);
250255
251256 // The ImageBuffer size needs to be scaled to match the final resolution.
252257 AffineTransform transform = context.getCTM();

@@void SVGImage::drawPatternForContainer(G
260265 std::unique_ptr<ImageBuffer> buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(imageBufferSize.size()), 1, ColorSpaceSRGB, context);
261266 if (!buffer) // Failed to allocate buffer.
262267 return;
263  drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, CompositeSourceOver, BlendModeNormal);
 268 drawForContainer(buffer->context(), containerSize, containerZoom, sourceURL, imageBufferSize, zoomedContainerRect, CompositeSourceOver, BlendModeNormal);
264269 if (context.drawLuminanceMask())
265270 buffer->convertToLuminanceMask();
266271

@@ImageDrawResult SVGImage::draw(GraphicsC
309314
310315 view->resize(containerSize());
311316
312  if (!m_url.isEmpty())
313  view->scrollToFragment(m_url);
314 
315317 if (view->needsLayout())
316318 view->layout();
317319

@@bool isInSVGImage(const Element* element
490492 return page->chrome().client().isSVGImageChromeClient();
491493}
492494
493 void SVGImage::dump(TextStream& ts) const
494 {
495  Image::dump(ts);
496  ts.dumpProperty("url", m_url.string());
497 }
498 
499 
500495}
221268

Source/WebCore/svg/graphics/SVGImage.h

@@class SVGImageForContainer;
4242
4343class SVGImage final : public Image {
4444public:
45  static Ref<SVGImage> create(ImageObserver& observer, const URL& url)
46  {
47  return adoptRef(*new SVGImage(observer, url));
48  }
 45 static Ref<SVGImage> create(ImageObserver& observer) { return adoptRef(*new SVGImage(observer)); }
4946
5047 RenderBox* embeddedContentBox() const;
5148 FrameView* frameView() const;

@@public:
5350 bool isSVGImage() const final { return true; }
5451 FloatSize size() const final { return m_intrinsicSize; }
5552
56  void setURL(const URL& url) { m_url = url; }
57 
5853 bool hasSingleSecurityOrigin() const final;
5954
6055 bool hasRelativeWidth() const final;

@@private:
9489 // FIXME: Implement this to be less conservative.
9590 bool currentFrameKnownToBeOpaque() const final { return false; }
9691
97  void dump(WTF::TextStream&) const final;
98 
99  SVGImage(ImageObserver&, const URL&);
 92 explicit SVGImage(ImageObserver&);
10093 ImageDrawResult draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
101  ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize, float, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode);
102  void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float zoom, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing,
 94 ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode);
 95 void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float containerZoom, const URL&, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing,
10396 CompositeOperator, const FloatRect&, BlendMode);
10497
10598 SVGSVGElement* rootElement() const;

@@private:
107100 std::unique_ptr<SVGImageChromeClient> m_chromeClient;
108101 std::unique_ptr<Page> m_page;
109102 FloatSize m_intrinsicSize;
110  URL m_url;
111103};
112104
113105bool isInSVGImage(const Element*);
221268

Source/WebCore/svg/graphics/SVGImageCache.cpp

2828#include "RenderSVGRoot.h"
2929#include "SVGImage.h"
3030#include "SVGImageForContainer.h"
 31#include "URL.h"
3132
3233namespace WebCore {
3334

@@void SVGImageCache::removeClientFromCach
4950 m_imageForContainerMap.remove(client);
5051}
5152
52 void SVGImageCache::setContainerSizeForRenderer(const CachedImageClient* client, const LayoutSize& containerSize, float containerZoom)
 53void SVGImageCache::setContainerContextForClient(const CachedImageClient* client, const LayoutSize& containerSize, float containerZoom, const URL& sourceURL)
5354{
5455 ASSERT(client);
5556 ASSERT(!containerSize.isEmpty());

@@void SVGImageCache::setContainerSizeForR
5859 FloatSize containerSizeWithoutZoom(containerSize);
5960 containerSizeWithoutZoom.scale(1 / containerZoom);
6061
61  m_imageForContainerMap.set(client, SVGImageForContainer::create(m_svgImage, containerSizeWithoutZoom, containerZoom));
 62 m_imageForContainerMap.set(client, SVGImageForContainer::create(m_svgImage, containerSizeWithoutZoom, containerZoom, sourceURL));
6263}
6364
6465Image* SVGImageCache::findImageForRenderer(const RenderObject* renderer) const
221268

Source/WebCore/svg/graphics/SVGImageCache.h

@@class LayoutSize;
3333class SVGImage;
3434class SVGImageForContainer;
3535class RenderObject;
 36class URL;
3637
3738class SVGImageCache {
3839 WTF_MAKE_FAST_ALLOCATED;

@@public:
4243
4344 void removeClientFromCache(const CachedImageClient*);
4445
45  void setContainerSizeForRenderer(const CachedImageClient*, const LayoutSize&, float);
 46 void setContainerContextForClient(const CachedImageClient*, const LayoutSize&, float, const URL&);
4647 FloatSize imageSizeForRenderer(const RenderObject*) const;
4748
4849 Image* imageForRenderer(const RenderObject*) const;
221268

Source/WebCore/svg/graphics/SVGImageForContainer.cpp

@@namespace WebCore {
3030FloatSize SVGImageForContainer::size() const
3131{
3232 FloatSize scaledContainerSize(m_containerSize);
33  scaledContainerSize.scale(m_zoom);
 33 scaledContainerSize.scale(m_containerZoom);
3434 return FloatSize(roundedIntSize(scaledContainerSize));
3535}
3636
3737ImageDrawResult SVGImageForContainer::draw(GraphicsContext& context, const FloatRect& dstRect,
3838 const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
3939{
40  return m_image->drawForContainer(context, m_containerSize, m_zoom, dstRect, srcRect, compositeOp, blendMode);
 40 return m_image->drawForContainer(context, m_containerSize, m_containerZoom, m_sourceURL, dstRect, srcRect, compositeOp, blendMode);
4141}
4242
4343void SVGImageForContainer::drawPattern(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
4444 const FloatPoint& phase, const FloatSize& spacing, CompositeOperator compositeOp, BlendMode blendMode)
4545{
46  m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, patternTransform, phase, spacing, compositeOp, dstRect, blendMode);
 46 m_image->drawPatternForContainer(context, m_containerSize, m_containerZoom, m_sourceURL, srcRect, patternTransform, phase, spacing, compositeOp, dstRect, blendMode);
4747}
4848
4949NativeImagePtr SVGImageForContainer::nativeImageForCurrentFrame(const GraphicsContext* targetContext)
221268

Source/WebCore/svg/graphics/SVGImageForContainer.h

@@namespace WebCore {
3636
3737class SVGImageForContainer final : public Image {
3838public:
39  static Ref<SVGImageForContainer> create(SVGImage* image, const FloatSize& containerSize, float zoom)
 39 static Ref<SVGImageForContainer> create(SVGImage* image, const FloatSize& containerSize, float containerZoom, const URL& sourceURL)
4040 {
41  return adoptRef(*new SVGImageForContainer(image, containerSize, zoom));
 41 return adoptRef(*new SVGImageForContainer(image, containerSize, containerZoom, sourceURL));
4242 }
4343
4444 bool isSVGImage() const final { return true; }
4545
4646 FloatSize size() const final;
4747
48  void setURL(const URL& url) { m_image->setURL(url); }
49 
5048 bool usesContainerSize() const final { return m_image->usesContainerSize(); }
5149 bool hasRelativeWidth() const final { return m_image->hasRelativeWidth(); }
5250 bool hasRelativeHeight() const final { return m_image->hasRelativeHeight(); }

@@public:
6563 NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
6664
6765private:
68  SVGImageForContainer(SVGImage* image, const FloatSize& containerSize, float zoom)
 66 SVGImageForContainer(SVGImage* image, const FloatSize& containerSize, float containerZoom, const URL& sourceURL)
6967 : m_image(image)
7068 , m_containerSize(containerSize)
71  , m_zoom(zoom)
 69 , m_containerZoom(containerZoom)
 70 , m_sourceURL(sourceURL)
7271 {
7372 }
7473

@@private:
7675
7776 SVGImage* m_image;
7877 const FloatSize m_containerSize;
79  const float m_zoom;
 78 const float m_containerZoom;
 79 const URL m_sourceURL;
8080};
8181
8282} // namespace WebCore
221268

LayoutTests/ChangeLog

 12017-08-23 Said Abou-Hallawa <sabouhallawa@apple.com>
 2
 3 The SVG fragment identifier is not respected if it is a part of an HTTP URL
 4 https://bugs.webkit.org/show_bug.cgi?id=163811
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * http/tests/svg/resources/rgb-icons-1.svg: Added.
 9 * http/tests/svg/resources/rgb-icons-2.svg: Added.
 10 * http/tests/svg/resources/rgb-icons-3.svg: Added.
 11 * http/tests/svg/svg-fragment-background-expected.html: Added.
 12 * http/tests/svg/svg-fragment-background.html: Added.
 13 * http/tests/svg/svg-fragment-image-expected.html: Added.
 14 * http/tests/svg/svg-fragment-image.html: Added.
 15
1162017-08-28 Matt Lewis <jlewis3@apple.com>
217
318 Marked svg/in-html/by-reference.html as flaky.
221268

LayoutTests/http/tests/svg/svg-fragment-background-expected.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4 <style>
 5 span {
 6 display: inline-block;
 7 width: 100px;
 8 height: 100px;
 9 background-color: green;
 10 }
 11 </style>
 12</head>
 13<body>
 14 <div>
 15 <p>background-image with with hide/show embedded :target CSS</p>
 16 <span></span>
 17 <span></span>
 18 <span></span>
 19 </div>
 20</body>
 21</html>
nonexistent

LayoutTests/http/tests/svg/svg-fragment-background.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4 <style>
 5 .icon {
 6 display: inline-block;
 7 width: 100px;
 8 height: 100px;
 9 }
 10 .green-icon-1 {
 11 background: url(resources/rgb-icons-3.svg#green-icon) no-repeat;
 12 }
 13 .green-icon-2 {
 14 background: url(http://localhost:8000/svg/resources/rgb-icons-3.svg#green-icon) no-repeat;
 15 }
 16 </style>
 17</head>
 18<body>
 19 <div id="group-1">
 20 <p>background-image with with hide/show embedded :target CSS</p>
 21 <span class="icon green-icon-1"></span>
 22 <span class="icon green-icon-2"></span>
 23 <span class="icon" id="green-icon"></span>
 24 </div>
 25 <script>
 26 if (window.testRunner)
 27 testRunner.waitUntilDone();
 28
 29 document.getElementById("green-icon").style.background = "url('http://127.0.0.1:8000/svg/resources/rgb-icons-3.svg#green-icon') no-repeat";
 30
 31 setTimeout(function() {
 32 if (window.testRunner)
 33 testRunner.notifyDone();
 34 }, 50);
 35 </script
 36</body>
 37</html>
nonexistent

LayoutTests/http/tests/svg/svg-fragment-image-expected.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4 <style>
 5 span {
 6 display: inline-block;
 7 width: 100px;
 8 height: 100px;
 9 background-color: green;
 10 }
 11 </style>
 12</head>
 13<body>
 14 <div>
 15 <p>&lt;img> with #fragment referencing &lt;view></p>
 16 <span></span>
 17 <span></span>
 18 <span></span>
 19 </div>
 20 <div>
 21 <p>&lt;img> with #svgView(viewBox())</p>
 22 <span></span>
 23 <span></span>
 24 <span></span>
 25 <div>
 26 <div>
 27 <p>&lt;img> with hide/show embedded :target CSS</p>
 28 <span></span>
 29 <span></span>
 30 <span></span>
 31 </div>
 32</body>
 33</html>
nonexistent

LayoutTests/http/tests/svg/svg-fragment-image.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4 <style>
 5 img {
 6 width: 100px;
 7 height: 100px;
 8 }
 9 </style>
 10</head>
 11<body>
 12 <div id="group-1">
 13 <p>&lt;img> with #fragment referencing &lt;view></p>
 14 <img src="resources/rgb-icons-1.svg#green-icon-view">
 15 <img src="http://localhost:8000/svg/resources/rgb-icons-1.svg#green-icon-view">
 16 </div>
 17 <div id="group-2">
 18 <p>&lt;img> with #svgView(viewBox())</p>
 19 <img src="resources/rgb-icons-2.svg#svgView(viewBox(0,32,32,32))">
 20 <img src="http://localhost:8000/svg/resources/rgb-icons-2.svg#svgView(viewBox(0,32,32,32))">
 21 </div>
 22 <div id="group-3">
 23 <p>&lt;img> with hide/show embedded :target CSS</p>
 24 <img src="resources/rgb-icons-3.svg#green-icon">
 25 <img src="http://localhost:8000/svg/resources/rgb-icons-3.svg#green-icon">
 26 </div>
 27 <script>
 28 function createAndLoadImage(parent, src, srcset) {
 29 return new Promise((resolve) => {
 30 var image = new Image;
 31 parent.appendChild(image);
 32 image.onload = (() => {
 33 resolve(image);
 34 });
 35 image.src = src;
 36 image.srcset = srcset;
 37 });
 38 }
 39
 40 (function() {
 41 if (window.testRunner)
 42 testRunner.waitUntilDone();
 43
 44 var imageData = [
 45 {
 46 "parent": document.getElementById("group-1"),
 47 "src": "http://127.0.0.1:8000/svg/resources/rgb-icons-1.svg#red-icon-view",
 48 "srcset": "http://127.0.0.1:8000/svg/resources/rgb-icons-1.svg#green-icon-view",
 49 },
 50 {
 51 "parent": document.getElementById("group-2"),
 52 "src": "http://127.0.0.1:8000/svg/resources/rgb-icons-2.svg#svgView(viewBox(0,0,32,32))",
 53 "srcset": "http://127.0.0.1:8000/svg/resources/rgb-icons-2.svg#svgView(viewBox(0,32,32,32))"
 54 },
 55 {
 56 "parent": document.getElementById("group-3"),
 57 "src" : "http://127.0.0.1:8000/svg/resources/rgb-icons-3.svg#red-icon",
 58 "srcset" : "http://127.0.0.1:8000/svg/resources/rgb-icons-3.svg#green-icon"
 59 },
 60 ];
 61
 62 var promises = [];
 63 for (let datum of imageData)
 64 promises.push(createAndLoadImage(datum.parent, datum.src, datum.srcset));
 65
 66 Promise.all(promises).then(() => {
 67 if (window.testRunner)
 68 testRunner.notifyDone();
 69 });
 70 })();
 71 </script>
 72</body>
 73</html>
nonexistent

LayoutTests/http/tests/svg/resources/rgb-icons-1.svg

 1<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 96">
 2 <view id="red-icon-view" viewBox="0 0 32 32"/>
 3 <view id="green-icon-view" viewBox="0 32 32 32"/>
 4 <view id="blue-icon-view" viewBox="0 64 32 32"/>
 5
 6 <rect fill="red" x="0" y="0" width="32" height="32"/>
 7 <rect fill="green" x="0" y="32" width="32" height="32"/>
 8 <rect fill="blue" x="0" y="64" width="32" height="32"/>
 9</svg>
nonexistent

LayoutTests/http/tests/svg/resources/rgb-icons-2.svg

 1<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 96">
 2 <rect id="red-icon" fill="red" x="0" y="0" width="32" height="32"/>
 3 <rect id="green-icon" fill="green" x="0" y="32" width="32" height="32"/>
 4 <rect id="blue-icon" fill="blue" x="0" y="64" width="32" height="32"/>
 5</svg>
nonexistent

LayoutTests/http/tests/svg/resources/rgb-icons-3.svg

 1<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
 2 <defs>
 3 <style>
 4 rect {
 5 display: none;
 6 }
 7 rect:target {
 8 display: inline;
 9 }
 10 </style>
 11 </defs>
 12 <rect id="red-icon" fill="red" width="32" height="32"/>
 13 <rect id="green-icon" fill="green" width="32" height="32"/>
 14 <rect id="blue-icon" fill="blue" width="32" height="32"/>
 15</svg>
nonexistent