Changeset 39104 in webkit
- Timestamp:
- Dec 8, 2008 3:18:20 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r39101 r39104 1 2008-12-08 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Tests cases for bug 17897: Not Rendering Images Imported from XHTML Document 6 <rdar://problem/5827614> 7 8 - xmlhttprequest-image-not-loaded*: test that an image loaded by an XMLHttpRequest and inserted into a XHTML or SVG Document 9 is properly rendered. 10 11 - image-blocked-src-change.html and image-blocked-src-no-change.html: test that an image that was in error is responding to src attribute change 12 (whether it does really change the url or not). 13 14 * http/tests/misc/image-blocked-src-change-expected.txt: Added. 15 * http/tests/misc/image-blocked-src-change.html: Added. 16 * http/tests/misc/image-blocked-src-no-change-expected.txt: Added. 17 * http/tests/misc/image-blocked-src-no-change.html: Added. 18 * http/tests/xmlhttprequest/resources/load-icon.svg: Added. 19 * http/tests/xmlhttprequest/resources/load-icon.xhtml: Added. 20 * http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded-expected.txt: Added. 21 * http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded-svg-expected.txt: Added. 22 * http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded-svg.svg: Added. 23 * http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded.html: Added. 24 1 25 2008-12-08 Mark Rowe <mrowe@apple.com> 2 26 -
trunk/WebCore/ChangeLog
r39103 r39104 1 2008-12-08 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Bug 17897: Not Rendering Images Imported from XHTML Document 6 <rdar://problem/5827614> 7 8 When we were loading document with XMLHttpRequest that contained images, the images 9 would not be fetched as they would not be displayed. However if we inserted such 10 an image element into a rendered document, we would not fetch the image and thus never 11 display it. 12 13 Now we check if the image has been loaded when we insert an HTMLImageElement into a 14 document. 15 To enable this, the image loader has an error flag. To avoid doing several attempts 16 when we know that the image is in error, we store the failed URL. 17 However Firefox and Opera ignore errors when the 'src' attribute changes and thus 18 we also have an updateFromElementIgnoringPreviousError to match the other browser. 19 20 Tests: http/tests/misc/image-blocked-src-change.html 21 http/tests/misc/image-blocked-src-no-change.html 22 http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded-svg.svg 23 http/tests/xmlhttprequest/xmlhttprequest-image-not-loaded.html 24 25 * html/HTMLEmbedElement.cpp: 26 (WebCore::HTMLEmbedElement::parseMappedAttribute): Changed to call updateFromElementIgnoringPreviousError. 27 * html/HTMLImageElement.cpp: 28 (WebCore::HTMLImageElement::parseMappedAttribute): Ditto. 29 (WebCore::HTMLImageElement::insertedIntoDocument): Call updateFromElement if we do not have 30 an image. 31 32 * html/HTMLInputElement.cpp: 33 (WebCore::HTMLInputElement::parseMappedAttribute): Changed to call updateFromElementIgnoringPreviousError. 34 * html/HTMLObjectElement.cpp: 35 (WebCore::HTMLObjectElement::parseMappedAttribute): Ditto. 36 * html/HTMLVideoElement.cpp: 37 (WebCore::HTMLVideoElement::parseMappedAttribute): Ditto. 38 * loader/ImageLoader.cpp: 39 (WebCore::ImageLoader::setImage): Added an assertion. 40 (WebCore::ImageLoader::updateFromElement): Added a check for load error (to avoid displaying 41 multiple errors in the console for a single image load). 42 43 (WebCore::ImageLoader::updateFromElementIgnoringPreviousError): This method clears previous error 44 before calling updateFromElement. 45 46 (WebCore::ImageLoader::notifyFinished): Added an assertion. 47 * loader/ImageLoader.h: 48 * svg/SVGImageElement.cpp: 49 (WebCore::SVGImageElement::svgAttributeChanged): Changed to call updateFromElementIgnoringPreviousError. 50 1 51 2008-12-08 David Hyatt <hyatt@apple.com> 2 52 -
trunk/WebCore/html/HTMLEmbedElement.cpp
r39065 r39104 103 103 if (!m_imageLoader) 104 104 m_imageLoader.set(new HTMLImageLoader(this)); 105 m_imageLoader->updateFromElement ();105 m_imageLoader->updateFromElementIgnoringPreviousError(); 106 106 } 107 107 } else if (attr->name() == hiddenAttr) { -
trunk/WebCore/html/HTMLImageElement.cpp
r39065 r39104 83 83 static_cast<RenderImage*>(renderer())->updateAltText(); 84 84 } else if (attrName == srcAttr) 85 m_imageLoader.updateFromElement ();85 m_imageLoader.updateFromElementIgnoringPreviousError(); 86 86 else if (attrName == widthAttr) 87 87 addCSSLength(attr, CSSPropertyWidth, attr->value()); … … 187 187 } 188 188 189 // If we have been inserted from a renderer-less document, 190 // our loader may have not fetched the image, so do it now. 191 if (!m_imageLoader.image()) 192 m_imageLoader.updateFromElement(); 193 189 194 HTMLElement::insertedIntoDocument(); 190 195 } -
trunk/WebCore/html/HTMLInputElement.cpp
r39065 r39104 645 645 if (!m_imageLoader) 646 646 m_imageLoader.set(new HTMLImageLoader(this)); 647 m_imageLoader->updateFromElement ();647 m_imageLoader->updateFromElementIgnoringPreviousError(); 648 648 } 649 649 } else if (attr->name() == usemapAttr || -
trunk/WebCore/html/HTMLObjectElement.cpp
r39065 r39104 88 88 if (!m_imageLoader) 89 89 m_imageLoader.set(new HTMLImageLoader(this)); 90 m_imageLoader->updateFromElement ();90 m_imageLoader->updateFromElementIgnoringPreviousError(); 91 91 } 92 92 } else if (attr->name() == classidAttr) { -
trunk/WebCore/html/HTMLVideoElement.cpp
r38881 r39104 94 94 if (!m_imageLoader) 95 95 m_imageLoader.set(new HTMLImageLoader(this)); 96 m_imageLoader->updateFromElement ();96 m_imageLoader->updateFromElementIgnoringPreviousError(); 97 97 } 98 98 } else if (attrName == widthAttr) -
trunk/WebCore/loader/ImageLoader.cpp
r38094 r39104 50 50 void ImageLoader::setImage(CachedImage* newImage) 51 51 { 52 ASSERT(m_failedLoadURL.isEmpty()); 52 53 CachedImage* oldImage = m_image.get(); 53 54 if (newImage != oldImage) { … … 87 88 AtomicString attr = elem->getAttribute(elem->imageSourceAttributeName()); 88 89 90 if (attr == m_failedLoadURL) 91 return; 92 89 93 // Do not load any image if the 'src' attribute is missing or if it is 90 94 // an empty string referring to a local file. The latter condition is … … 101 105 } else 102 106 newImage = doc->docLoader()->requestImage(sourceURI(attr)); 107 108 // If we do not have an image here, it means that a cross-site 109 // violation occurred. 110 m_failedLoadURL = !newImage ? attr : AtomicString(); 103 111 } 104 112 … … 120 128 } 121 129 130 void ImageLoader::updateFromElementIgnoringPreviousError() 131 { 132 // Clear previous error. 133 m_failedLoadURL = AtomicString(); 134 updateFromElement(); 135 } 136 122 137 void ImageLoader::notifyFinished(CachedResource *image) 123 138 { 139 ASSERT(m_failedLoadURL.isEmpty()); 124 140 m_imageComplete = true; 125 141 -
trunk/WebCore/loader/ImageLoader.h
r36712 r39104 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) … … 26 24 #define ImageLoader_h 27 25 26 #include "AtomicString.h" 28 27 #include "CachedResourceClient.h" 29 28 #include "CachedResourceHandle.h" … … 31 30 namespace WebCore { 32 31 33 class AtomicString;34 32 class Element; 35 33 … … 40 38 41 39 void updateFromElement(); 40 41 // This method should be called after the 'src' attribute 42 // is set (even when it is not modified) to force the update 43 // and match Firefox and Opera. 44 void updateFromElementIgnoringPreviousError(); 42 45 43 46 virtual void dispatchLoadEvent() = 0; … … 64 67 Element* m_element; 65 68 CachedResourceHandle<CachedImage> m_image; 69 AtomicString m_failedLoadURL; 66 70 bool m_firedLoad : 1; 67 71 bool m_imageComplete : 1; -
trunk/WebCore/svg/SVGImageElement.cpp
r39065 r39104 109 109 110 110 if (isURIAttribute) 111 m_imageLoader.updateFromElement ();111 m_imageLoader.updateFromElementIgnoringPreviousError(); 112 112 } 113 113 }
Note: See TracChangeset
for help on using the changeset viewer.