Title: [164983] trunk/Source/WebCore
- Revision
- 164983
- Author
- grao...@webkit.org
- Date
- 2014-03-03 03:57:30 -0800 (Mon, 03 Mar 2014)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (164982 => 164983)
--- trunk/Source/WebCore/ChangeLog 2014-03-03 10:32:58 UTC (rev 164982)
+++ trunk/Source/WebCore/ChangeLog 2014-03-03 11:57:30 UTC (rev 164983)
@@ -1,3 +1,22 @@
+2014-03-03 Antoine Quint <grao...@webkit.org>
+
+ 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:
+
2014-03-03 Laszlo Vidacs <lvidacs.u-sze...@partner.samsung.com>
Move function calls outside loop in dom
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (164982 => 164983)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2014-03-03 10:32:58 UTC (rev 164982)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2014-03-03 11:57:30 UTC (rev 164983)
@@ -220,6 +220,7 @@
return;
FrameView* view = frameView();
+ ASSERT(view);
GraphicsContextStateSaver stateSaver(*context);
context->setCompositeOperation(compositeOp, blendMode);
@@ -252,6 +253,9 @@
stateSaver.restore();
+ if (!m_url.isEmpty())
+ view->scrollToFragment(m_url);
+
if (imageObserver())
imageObserver()->didDraw(this);
}
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (164982 => 164983)
--- trunk/Source/WebCore/svg/graphics/SVGImage.h 2014-03-03 10:32:58 UTC (rev 164982)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h 2014-03-03 11:57:30 UTC (rev 164983)
@@ -28,6 +28,7 @@
#define SVGImage_h
#include "Image.h"
+#include "URL.h"
namespace WebCore {
@@ -52,6 +53,8 @@
virtual bool isSVGImage() const override { return true; }
virtual IntSize size() const override { return m_intrinsicSize; }
+ void setURL(const URL& url) { m_url = url; }
+
virtual bool hasSingleSecurityOrigin() const override;
virtual bool hasRelativeWidth() const override;
@@ -95,6 +98,7 @@
std::unique_ptr<SVGImageChromeClient> m_chromeClient;
std::unique_ptr<Page> m_page;
IntSize m_intrinsicSize;
+ URL m_url;
};
bool isInSVGImage(const Element*);
Modified: trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp (164982 => 164983)
--- trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp 2014-03-03 10:32:58 UTC (rev 164982)
+++ trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp 2014-03-03 11:57:30 UTC (rev 164983)
@@ -25,7 +25,6 @@
#include "FloatSize.h"
#include "FrameView.h"
#include "Image.h"
-#include "SVGImage.h"
namespace WebCore {
@@ -54,9 +53,4 @@
return m_image->nativeImageForCurrentFrame();
}
-void SVGImageForContainer::setURL(const URL& url)
-{
- m_image->frameView()->scrollToFragment(url);
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/graphics/SVGImageForContainer.h (164982 => 164983)
--- trunk/Source/WebCore/svg/graphics/SVGImageForContainer.h 2014-03-03 10:32:58 UTC (rev 164982)
+++ trunk/Source/WebCore/svg/graphics/SVGImageForContainer.h 2014-03-03 11:57:30 UTC (rev 164983)
@@ -46,7 +46,7 @@
virtual IntSize size() const override;
- void setURL(const URL&);
+ void setURL(const URL& url) { m_image->setURL(url); }
virtual bool usesContainerSize() const override { return m_image->usesContainerSize(); }
virtual bool hasRelativeWidth() const override { return m_image->hasRelativeWidth(); }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes