Title: [182751] trunk
- Revision
- 182751
- Author
- [email protected]
- Date
- 2015-04-13 13:02:20 -0700 (Mon, 13 Apr 2015)
Log Message
list-style-image with SVG image renders at incorrect size.
https://bugs.webkit.org/show_bug.cgi?id=141367.
Patch by Said Abou-Hallawa <[email protected]> on 2015-04-13
Reviewed by Darin Adler.
Source/WebCore:
This patch imports https://codereview.chromium.org/197203003.
When using an SVG as list marker image, don't unconditionally set the
dimensions to a square with the dimensions of ascent / 2, but rather
determine a suitable size using intrinsic dimensions (and ratio).
Test: svg/as-list-image/svg-list-image-intrinsic-size-1.html
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::updateContent):
LayoutTests:
Ensure the SVG image gets the correct size when used as an image list.
* svg/as-list-image: Added.
* svg/as-list-image/svg-list-image-intrinsic-size-1-expected.html: Added.
* svg/as-list-image/svg-list-image-intrinsic-size-1.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (182750 => 182751)
--- trunk/LayoutTests/ChangeLog 2015-04-13 19:53:14 UTC (rev 182750)
+++ trunk/LayoutTests/ChangeLog 2015-04-13 20:02:20 UTC (rev 182751)
@@ -1,5 +1,18 @@
2015-04-13 Said Abou-Hallawa <[email protected]>
+ list-style-image with SVG image renders at incorrect size.
+ https://bugs.webkit.org/show_bug.cgi?id=141367.
+
+ Reviewed by Darin Adler.
+
+ Ensure the SVG image gets the correct size when used as an image list.
+
+ * svg/as-list-image: Added.
+ * svg/as-list-image/svg-list-image-intrinsic-size-1-expected.html: Added.
+ * svg/as-list-image/svg-list-image-intrinsic-size-1.html: Added.
+
+2015-04-13 Said Abou-Hallawa <[email protected]>
+
Canvas drawImage() has a security hole when the image isn't yet fully loaded.
https://bugs.webkit.org/show_bug.cgi?id=58681.
Added: trunk/LayoutTests/svg/as-list-image/svg-list-image-intrinsic-size-1-expected.html (0 => 182751)
--- trunk/LayoutTests/svg/as-list-image/svg-list-image-intrinsic-size-1-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-list-image/svg-list-image-intrinsic-size-1-expected.html 2015-04-13 20:02:20 UTC (rev 182751)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<style>
+ li { list-style-image: url('data:image/png;base64, \
+ iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAQAAABjudZnAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwA \
+ ACxMAAAsTAQCanBgAAAAOSURBVAjXY2T4z0A2AAA7PwEBN+ncIAAAAABJRU5ErkJggg==');
+ }
+</style>
+<ul>
+ <li>Bullet 1</li>
+ <li>Bullet 2</li>
+</ul>
\ No newline at end of file
Added: trunk/LayoutTests/svg/as-list-image/svg-list-image-intrinsic-size-1.html (0 => 182751)
--- trunk/LayoutTests/svg/as-list-image/svg-list-image-intrinsic-size-1.html (rev 0)
+++ trunk/LayoutTests/svg/as-list-image/svg-list-image-intrinsic-size-1.html 2015-04-13 20:02:20 UTC (rev 182751)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+ li { list-style-image: url('data:image/svg+xml, \
+ <svg width="30px" height="1px" xmlns="http://www.w3.org/2000/svg"> \
+ <line x2="30" stroke-width="2" stroke="black"/> \
+ </svg>');
+ }
+</style>
+<ul>
+ <li>Bullet 1</li>
+ <li>Bullet 2</li>
+</ul>
Modified: trunk/Source/WebCore/ChangeLog (182750 => 182751)
--- trunk/Source/WebCore/ChangeLog 2015-04-13 19:53:14 UTC (rev 182750)
+++ trunk/Source/WebCore/ChangeLog 2015-04-13 20:02:20 UTC (rev 182751)
@@ -1,5 +1,23 @@
2015-04-13 Said Abou-Hallawa <[email protected]>
+ list-style-image with SVG image renders at incorrect size.
+ https://bugs.webkit.org/show_bug.cgi?id=141367.
+
+ Reviewed by Darin Adler.
+
+ This patch imports https://codereview.chromium.org/197203003.
+
+ When using an SVG as list marker image, don't unconditionally set the
+ dimensions to a square with the dimensions of ascent / 2, but rather
+ determine a suitable size using intrinsic dimensions (and ratio).
+
+ Test: svg/as-list-image/svg-list-image-intrinsic-size-1.html
+
+ * rendering/RenderListMarker.cpp:
+ (WebCore::RenderListMarker::updateContent):
+
+2015-04-13 Said Abou-Hallawa <[email protected]>
+
Canvas drawImage() has a security hole when the image isn't yet fully loaded.
https://bugs.webkit.org/show_bug.cgi?id=58681.
Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (182750 => 182751)
--- trunk/Source/WebCore/rendering/RenderListMarker.cpp 2015-04-13 19:53:14 UTC (rev 182750)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp 2015-04-13 20:02:20 UTC (rev 182751)
@@ -1424,8 +1424,10 @@
if (isImage()) {
// FIXME: This is a somewhat arbitrary width. Generated images for markers really won't become particularly useful
// until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
- int bulletWidth = style().fontMetrics().ascent() / 2;
- m_image->setContainerSizeForRenderer(this, FloatSize(bulletWidth, bulletWidth), style().effectiveZoom());
+ LayoutUnit bulletWidth = style().fontMetrics().ascent() / LayoutUnit(2);
+ LayoutSize defaultBulletSize(bulletWidth, bulletWidth);
+ LayoutSize imageSize = calculateImageIntrinsicDimensions(m_image.get(), defaultBulletSize, DoNotScaleByEffectiveZoom);
+ m_image->setContainerSizeForRenderer(this, imageSize, style().effectiveZoom());
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes