Changeset 57109 in webkit


Ignore:
Timestamp:
Apr 5, 2010 6:38:15 PM (14 years ago)
Author:
Darin Adler
Message:

Images must re-load when an image-holding element moves into a new document
https://bugs.webkit.org/show_bug.cgi?id=37127

Reviewed by Sam Weinig.

WebCore:

Test: fast/images/move-image-to-new-document.html

  • html/HTMLImageElement.cpp:

(WebCore::HTMLImageElement::willMoveToNewOwnerDocument): Call ImageLoader's
elementWillMoveToNewOwnerDocument function.

  • html/HTMLImageElement.h: Added willMoveToNewOwnerDocument.
  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::willMoveToNewOwnerDocument): Ditto.

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::willMoveToNewOwnerDocument): Ditto.

  • html/HTMLPlugInImageElement.h: Ditto.
  • html/HTMLVideoElement.cpp:

(WebCore::HTMLVideoElement::willMoveToNewOwnerDocument): Ditto.

  • html/HTMLVideoElement.h: Ditto.
  • svg/SVGImageElement.cpp:

(WebCore::SVGImageElement::willMoveToNewOwnerDocument): Ditto.

  • svg/SVGImageElement.h: Ditto.
  • html/HTMLMediaElement.h: Made willMoveToNewOwnerDocument protected

so it can be called by HTMLVideoElement.cpp.

  • loader/ImageLoader.cpp:

(WebCore::ImageLoader::elementWillMoveToNewOwnerDocument): Added.
Resets the loader by clearing out the cached image.

  • loader/ImageLoader.h: Added it.

LayoutTests:

  • fast/images/move-image-to-new-document-expected.txt: Added.
  • fast/images/move-image-to-new-document.html: Added.
  • fast/images/script-tests/move-image-to-new-document.js: Added.
  • fast/js/resources/js-test-post.js: Added a feature for doing asynchronous scripting

tests. The caller sets jsTestIsAsync to true and then calls finishJSTest when done.
Used by the above test.

  • platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.checksum:
  • platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.png:
  • platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.txt:

Updated since the old test result relied on an incorrect load of an image.
The relative URL has a different base when moved into the subframe document.

Location:
trunk
Files:
3 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57106 r57109  
     12010-04-05  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Images must re-load when an image-holding element moves into a new document
     6        https://bugs.webkit.org/show_bug.cgi?id=37127
     7
     8        * fast/images/move-image-to-new-document-expected.txt: Added.
     9        * fast/images/move-image-to-new-document.html: Added.
     10        * fast/images/script-tests/move-image-to-new-document.js: Added.
     11
     12        * fast/js/resources/js-test-post.js: Added a feature for doing asynchronous scripting
     13        tests. The caller sets jsTestIsAsync to true and then calls finishJSTest when done.
     14        Used by the above test.
     15
     16        * platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.checksum:
     17        * platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.png:
     18        * platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.txt:
     19        Updated since the old test result relied on an incorrect load of an image.
     20        The relative URL has a different base when moved into the subframe document.
     21
    1222010-04-05  Zhenyao Mo  <zmo@google.com>
    223
  • trunk/LayoutTests/fast/js/resources/js-test-post.js

    r26740 r57109  
    1 shouldBeTrue("successfullyParsed");
    2 debug('<br /><span class="pass">TEST COMPLETE</span>');
     1function finishJSTest()
     2{
     3    shouldBeTrue("successfullyParsed");
     4    debug('<br /><span class="pass">TEST COMPLETE</span>');
     5    if (window.jsTestIsAsync && window.layoutTestController)
     6        layoutTestController.notifyDone();
     7}
     8
     9if (window.jsTestIsAsync) {
     10    if (window.layoutTestController)
     11        layoutTestController.waitUntilDone();
     12} else
     13    finishJSTest();
  • trunk/LayoutTests/platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.checksum

    r38122 r57109  
    1 7298c7dcbdc31a24ef27cbbdf78380cd
     1507f0044be28d7fe3ca8a3ae46f4e8d6
  • trunk/LayoutTests/platform/mac/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.txt

    r30635 r57109  
    1919              RenderBody {BODY} at (8,8) size 284x134
    2020                RenderBlock {DIV} at (0,0) size 271x129 [border: (1px solid #000000)]
    21                   RenderImage {IMG} at (1,84) size 20x20
    22                   RenderImage {IMG} at (21,1) size 76x103
     21                  RenderImage {IMG} at (1,1) size 20x20
     22                  RenderImage {IMG} at (21,1) size 20x20
    2323        RenderText {#text} at (0,0) size 0x0
    2424      RenderBlock {UL} at (0,226) size 784x0
  • trunk/WebCore/ChangeLog

    r57108 r57109  
     12010-04-05  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Images must re-load when an image-holding element moves into a new document
     6        https://bugs.webkit.org/show_bug.cgi?id=37127
     7
     8        Test: fast/images/move-image-to-new-document.html
     9
     10        * html/HTMLImageElement.cpp:
     11        (WebCore::HTMLImageElement::willMoveToNewOwnerDocument): Call ImageLoader's
     12        elementWillMoveToNewOwnerDocument function.
     13        * html/HTMLImageElement.h: Added willMoveToNewOwnerDocument.
     14        * html/HTMLInputElement.cpp:
     15        (WebCore::HTMLInputElement::willMoveToNewOwnerDocument): Ditto.
     16        * html/HTMLPlugInImageElement.cpp:
     17        (WebCore::HTMLPlugInImageElement::willMoveToNewOwnerDocument): Ditto.
     18        * html/HTMLPlugInImageElement.h: Ditto.
     19        * html/HTMLVideoElement.cpp:
     20        (WebCore::HTMLVideoElement::willMoveToNewOwnerDocument): Ditto.
     21        * html/HTMLVideoElement.h: Ditto.
     22        * svg/SVGImageElement.cpp:
     23        (WebCore::SVGImageElement::willMoveToNewOwnerDocument): Ditto.
     24        * svg/SVGImageElement.h: Ditto.
     25
     26        * html/HTMLMediaElement.h: Made willMoveToNewOwnerDocument protected
     27        so it can be called by HTMLVideoElement.cpp.
     28
     29        * loader/ImageLoader.cpp:
     30        (WebCore::ImageLoader::elementWillMoveToNewOwnerDocument): Added.
     31        Resets the loader by clearing out the cached image.
     32        * loader/ImageLoader.h: Added it.
     33
    1342010-04-05  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    235
  • trunk/WebCore/html/HTMLImageElement.cpp

    r54999 r57109  
    436436}
    437437
    438 }
     438void HTMLImageElement::willMoveToNewOwnerDocument()
     439{
     440    m_imageLoader.elementWillMoveToNewOwnerDocument();
     441    HTMLElement::willMoveToNewOwnerDocument();
     442}
     443
     444}
  • trunk/WebCore/html/HTMLImageElement.h

    r54999 r57109  
    106106    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
    107107
     108protected:
     109    virtual void willMoveToNewOwnerDocument();
     110
    108111private:
    109112    virtual void insertedIntoDocument();
  • trunk/WebCore/html/HTMLInputElement.cpp

    r57013 r57109  
    26032603void HTMLInputElement::willMoveToNewOwnerDocument()
    26042604{
     2605    if (m_imageLoader)
     2606        m_imageLoader->elementWillMoveToNewOwnerDocument();
     2607
    26052608    // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
    26062609    if (needsActivationCallback())
  • trunk/WebCore/html/HTMLMediaElement.h

    r56650 r57109  
    174174    virtual ~HTMLMediaElement();
    175175
    176     virtual void parseMappedAttribute(MappedAttribute *);
     176    virtual void parseMappedAttribute(MappedAttribute*);
    177177    virtual void attach();
     178
     179    virtual void willMoveToNewOwnerDocument();
     180    virtual void didMoveToNewOwnerDocument();
    178181
    179182private:
     
    198201    void setReadyState(MediaPlayer::ReadyState);
    199202    void setNetworkState(MediaPlayer::NetworkState);
    200 
    201     virtual void willMoveToNewOwnerDocument();
    202     virtual void didMoveToNewOwnerDocument();
    203203
    204204    virtual Document* mediaPlayerOwningDocument();
  • trunk/WebCore/html/HTMLPlugInImageElement.cpp

    r35606 r57109  
    3535}
    3636
    37 HTMLPlugInImageElement::~HTMLPlugInImageElement()
    38 {
    39 }
    40 
    4137bool HTMLPlugInImageElement::isImageType()
    4238{
     
    5248}
    5349
     50void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
     51{
     52    if (m_imageLoader)
     53        m_imageLoader->elementWillMoveToNewOwnerDocument();
     54    HTMLPlugInElement::willMoveToNewOwnerDocument();
     55}
     56
    5457} // namespace WebCore
  • trunk/WebCore/html/HTMLPlugInImageElement.h

    r47688 r57109  
    3131class HTMLPlugInImageElement : public HTMLPlugInElement {
    3232public:
    33     virtual ~HTMLPlugInImageElement();
    34 
    3533    const String& serviceType() const { return m_serviceType; }
    3634    const String& url() const { return m_url; }
     
    4442    String m_serviceType;
    4543    String m_url;
     44
     45private:
     46    virtual void willMoveToNewOwnerDocument();
    4647};
    4748
  • trunk/WebCore/html/HTMLVideoElement.cpp

    r55946 r57109  
    246246}
    247247
    248 
    249 }
    250 #endif
     248void HTMLVideoElement::willMoveToNewOwnerDocument()
     249{
     250    if (m_imageLoader)
     251        m_imageLoader->elementWillMoveToNewOwnerDocument();
     252    HTMLMediaElement::willMoveToNewOwnerDocument();
     253}
     254
     255}
     256#endif
  • trunk/WebCore/html/HTMLVideoElement.h

    r56650 r57109  
    8383    virtual bool hasAvailableVideoFrame() const;
    8484    virtual void updatePosterImage();
     85    virtual void willMoveToNewOwnerDocument();
    8586
    8687    OwnPtr<HTMLImageLoader> m_imageLoader;
  • trunk/WebCore/loader/ImageLoader.cpp

    r55029 r57109  
    278278}
    279279
     280void ImageLoader::elementWillMoveToNewOwnerDocument()
     281{
     282    setImage(0);
     283}
     284
    280285ImageEventSender::ImageEventSender(const AtomicString& eventType)
    281286    : m_eventType(eventType)
  • trunk/WebCore/loader/ImageLoader.h

    r54618 r57109  
    4646    void updateFromElementIgnoringPreviousError();
    4747
     48    void elementWillMoveToNewOwnerDocument();
     49
    4850    Element* element() const { return m_element; }
    4951    bool imageComplete() const { return m_imageComplete; }
  • trunk/WebCore/svg/SVGImageElement.cpp

    r53879 r57109  
    186186}
    187187
     188void SVGImageElement::willMoveToNewOwnerDocument()
     189{
     190    m_imageLoader.elementWillMoveToNewOwnerDocument();
     191    SVGStyledTransformableElement::willMoveToNewOwnerDocument();
     192}
     193
    188194}
    189195
  • trunk/WebCore/svg/SVGImageElement.h

    r53879 r57109  
    6363
    6464    private:
     65        virtual void willMoveToNewOwnerDocument();
     66
    6567        DECLARE_ANIMATED_PROPERTY(SVGImageElement, SVGNames::xAttr, SVGLength, X, x)
    6668        DECLARE_ANIMATED_PROPERTY(SVGImageElement, SVGNames::yAttr, SVGLength, Y, y)
Note: See TracChangeset for help on using the changeset viewer.