Changeset 164983 in webkit


Ignore:
Timestamp:
Mar 3, 2014, 3:57:30 AM (12 years ago)
Author:
graouts@webkit.org
Message:

Respect SVG fragment identifiers in <img> src attribute
https://bugs.webkit.org/show_bug.cgi?id=129387

Reviewed by Dirk Schulze.

Following Dirk Schulze's suggestion, we set the URL on the SVGImage itself and handle the URL's
fragment identifier at draw time in the SVGImage itself, which will provide a sounder base for
handling of fragment identifier in SVG resource URLs in CSS properties, and should also deal
with the crasher reported in http://webkit.org/b/129498 since there is a guaranteed Frame at the
time we call SVGImage::draw().

  • svg/graphics/SVGImage.cpp:

(WebCore::SVGImage::draw):

  • svg/graphics/SVGImage.h:
  • svg/graphics/SVGImageForContainer.cpp:
  • svg/graphics/SVGImageForContainer.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r164981 r164983  
     12014-03-03  Antoine Quint  <graouts@webkit.org>
     2
     3        Respect SVG fragment identifiers in <img> src attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=129387
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Following Dirk Schulze's suggestion, we set the URL on the SVGImage itself and handle the URL's
     9        fragment identifier at draw time in the SVGImage itself, which will provide a sounder base for
     10        handling of fragment identifier in SVG resource URLs in CSS properties, and should also deal
     11        with the crasher reported in http://webkit.org/b/129498 since there is a guaranteed Frame at the
     12        time we call SVGImage::draw().
     13
     14        * svg/graphics/SVGImage.cpp:
     15        (WebCore::SVGImage::draw):
     16        * svg/graphics/SVGImage.h:
     17        * svg/graphics/SVGImageForContainer.cpp:
     18        * svg/graphics/SVGImageForContainer.h:
     19
    1202014-03-03  Laszlo Vidacs  <lvidacs.u-szeged@partner.samsung.com>
    221
  • trunk/Source/WebCore/svg/graphics/SVGImage.cpp

    r163440 r164983  
    221221
    222222    FrameView* view = frameView();
     223    ASSERT(view);
    223224
    224225    GraphicsContextStateSaver stateSaver(*context);
     
    252253
    253254    stateSaver.restore();
     255
     256    if (!m_url.isEmpty())
     257        view->scrollToFragment(m_url);
    254258
    255259    if (imageObserver())
  • trunk/Source/WebCore/svg/graphics/SVGImage.h

    r163440 r164983  
    2929
    3030#include "Image.h"
     31#include "URL.h"
    3132
    3233namespace WebCore {
     
    5253    virtual bool isSVGImage() const override { return true; }
    5354    virtual IntSize size() const override { return m_intrinsicSize; }
     55
     56    void setURL(const URL& url) { m_url = url; }
    5457
    5558    virtual bool hasSingleSecurityOrigin() const override;
     
    9699    std::unique_ptr<Page> m_page;
    97100    IntSize m_intrinsicSize;
     101    URL m_url;
    98102};
    99103
  • trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp

    r164804 r164983  
    2626#include "FrameView.h"
    2727#include "Image.h"
    28 #include "SVGImage.h"
    2928
    3029namespace WebCore {
     
    5554}
    5655
    57 void SVGImageForContainer::setURL(const URL& url)
    58 {
    59     m_image->frameView()->scrollToFragment(url);
    60 }
    61 
    6256} // namespace WebCore
  • trunk/Source/WebCore/svg/graphics/SVGImageForContainer.h

    r164804 r164983  
    4747    virtual IntSize size() const override;
    4848
    49     void setURL(const URL&);
     49    void setURL(const URL& url) { m_image->setURL(url); }
    5050
    5151    virtual bool usesContainerSize() const override { return m_image->usesContainerSize(); }
Note: See TracChangeset for help on using the changeset viewer.