Diff
Modified: trunk/LayoutTests/ChangeLog (115640 => 115641)
--- trunk/LayoutTests/ChangeLog 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/LayoutTests/ChangeLog 2012-04-30 15:42:28 UTC (rev 115641)
@@ -1,3 +1,19 @@
+2012-04-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=82922
+ border-image with image-set does not render correctly when viewed at
+ 2x
+ -and corresponding-
+ <rdar://problem/11167820>
+
+ Reviewed by Dan Bernstein.
+
+ * fast/hidpi/image-set-border-image-comparison.html: Added.
+ * fast/hidpi/resources/Breakpoint-2x.png: Added.
+ * fast/hidpi/resources/Breakpoint.png: Added.
+ * platform/mac/fast/hidpi/image-set-border-image-comparison-expected.png: Added.
+ * platform/mac/fast/hidpi/image-set-border-image-comparison-expected.txt: Added.
+
2012-04-30 Andreas Kling <[email protected]>
Rebaseline svg/zoom/page/zoom-svg-through-object-with-percentage-size.svg for Mac after Length changes.
Added: trunk/LayoutTests/fast/hidpi/image-set-border-image-comparison.html (0 => 115641)
--- trunk/LayoutTests/fast/hidpi/image-set-border-image-comparison.html (rev 0)
+++ trunk/LayoutTests/fast/hidpi/image-set-border-image-comparison.html 2012-04-30 15:42:28 UTC (rev 115641)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script>
+ function startTest() {
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.setBackingScaleFactor(2, finishTest);
+ }
+ }
+
+ function finishTest() {
+ setTimeout(function() { layoutTestController.notifyDone(); }, 0);
+ }
+</script>
+
+<style>
+div {
+ box-sizing: border-box;
+ width: 40px;
+ height: 13px;
+}
+
+.test1 {
+ border-image: -webkit-image-set(url('resources/Breakpoint.png') 1x, url('resources/Breakpoint-2x.png') 2x) 3 7 3 3 fill / 3px 7px 3px 3px;
+}
+
+.test2 {
+ border-image: -webkit-image-set(url('resources/Breakpoint.png') 1x, url('resources/Breakpoint-2x.png') 2x) 3 7 3 3 fill;
+ border-width: 3px 7px 3px 3px;
+}
+
+.test3 {
+ border-image: url('resources/Breakpoint.png') 3 7 3 3 fill / 3px 7px 3px 3px;
+}
+
+.test4 {
+ border-image: url('resources/Breakpoint.png') 3 7 3 3 fill;
+ border-width: 3px 7px 3px 3px;
+}
+
+@media (-webkit-min-device-pixel-ratio: 2) {
+ .test3, .test4 {
+ border-image-source: url('resources/Breakpoint-2x.png');
+ border-image-slice: 6 14 6 6 fill;
+ }
+}
+</style>
+</head>
+
+<body _onload_="startTest();">
+The first two tests should match the last two.<br><br>
+<div class="test1"></div><br>
+<div class="test2"></div><br>
+<div class="test3"></div><br>
+<div class="test4"></div><br>
+</body>
+</html>
Added: trunk/LayoutTests/fast/hidpi/resources/Breakpoint-2x.png
(Binary files differ)
Property changes on: trunk/LayoutTests/fast/hidpi/resources/Breakpoint-2x.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/fast/hidpi/resources/Breakpoint.png
(Binary files differ)
Property changes on: trunk/LayoutTests/fast/hidpi/resources/Breakpoint.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/fast/hidpi/image-set-border-image-comparison-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/hidpi/image-set-border-image-comparison-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/fast/hidpi/image-set-border-image-comparison-expected.txt (0 => 115641)
--- trunk/LayoutTests/platform/mac/fast/hidpi/image-set-border-image-comparison-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/hidpi/image-set-border-image-comparison-expected.txt 2012-04-30 15:42:28 UTC (rev 115641)
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock (anonymous) at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 280x18
+ text run at (0,0) width 280: "The first two tests should match the last two."
+ RenderBR {BR} at (280,14) size 0x0
+ RenderBR {BR} at (0,18) size 0x18
+ RenderBlock {DIV} at (0,36) size 40x13 [border:]
+ RenderBlock (anonymous) at (0,49) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderBlock {DIV} at (0,67) size 40x13 [border: (7px none #000000) (3px none #000000)]
+ RenderBlock (anonymous) at (0,80) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderBlock {DIV} at (0,98) size 40x13 [border:]
+ RenderBlock (anonymous) at (0,111) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderBlock {DIV} at (0,129) size 40x13 [border: (7px none #000000) (3px none #000000)]
+ RenderBlock (anonymous) at (0,142) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
Modified: trunk/Source/WebCore/ChangeLog (115640 => 115641)
--- trunk/Source/WebCore/ChangeLog 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/ChangeLog 2012-04-30 15:42:28 UTC (rev 115641)
@@ -1,3 +1,70 @@
+2012-04-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=82922
+ border-image with image-set does not render correctly when viewed at
+ 2x
+ -and corresponding-
+ <rdar://problem/11167820>
+
+ Reviewed by Dan Bernstein.
+
+ StyleImage::computeIntrinsicDimensions() is only called from one
+ place: RenderBoxModelObject::calculateIntrinsicDimensions(), and that
+ is only used for background images and border images. In my original
+ image-set work, I decided that
+ StyleCachedImageSet::computeIntrinsicDimensions() would compute
+ "intrinsic" dimensions, meaning that they would compute the dimensions
+ that the image resource was pretending to be rather than the actual
+ dimensions of the resource. I chose to do this because it made
+ background images work great without changing the call-site. But border
+ images need to know the actual intrinsic dimensions, so this design
+ decision (which was admittedly questionable from the start) won't
+ stick.
+
+ This patch makes StyleImage::computeIntrinsicDimensions() return
+ actual intrinsic dimensions. Then the border-image and background-
+ image code is very lightly patched to account for the image's scale
+ factor.
+
+ These functions no longer need the scale factor parameter.
+ * loader/cache/CachedImage.cpp:
+ (WebCore::CachedImage::computeIntrinsicDimensions):
+ * loader/cache/CachedImage.h:
+ (CachedImage):
+ * platform/graphics/GeneratedImage.h:
+ (GeneratedImage):
+ * platform/graphics/GeneratorGeneratedImage.cpp:
+ (WebCore::GeneratedImage::computeIntrinsicDimensions):
+ * platform/graphics/Image.cpp:
+ (WebCore::Image::computeIntrinsicDimensions):
+ * platform/graphics/Image.h:
+ (Image):
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::PDFDocumentImage::computeIntrinsicDimensions):
+ * platform/graphics/cg/PDFDocumentImage.h:
+ (PDFDocumentImage):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::computeIntrinsicDimensions):
+ * svg/graphics/SVGImage.h:
+ (SVGImage):
+ * rendering/style/StyleCachedImageSet.cpp:
+ (WebCore::StyleCachedImageSet::computeIntrinsicDimensions):
+
+ New function on StyleImage returns the image's scale factor.
+ * rendering/style/StyleCachedImageSet.h:
+ (WebCore::StyleCachedImageSet::imageScaleFactor):
+ * rendering/style/StyleImage.h:
+ (WebCore::StyleImage::imageScaleFactor):
+
+ Scale the intrinsic size of the background image down by the scale
+ factor.
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::calculateFillTileSize):
+
+ Slices should be multiplied by the image's scale factor since they are
+ always expected to the specified in the 1x image's coordinate space.
+ (WebCore::RenderBoxModelObject::paintNinePieceImage):
+
2012-04-30 Arko Saha <[email protected]>
Remove custom bindings code in JSHTMLCollectionCustom.cpp for HTMLPropertiesCollection.
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (115640 => 115641)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -270,10 +270,10 @@
return imageSize;
}
-void CachedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor)
+void CachedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
if (m_image)
- m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio, scaleFactor);
+ m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
}
void CachedImage::notifyObservers(const IntRect* changeRect)
Modified: trunk/Source/WebCore/loader/cache/CachedImage.h (115640 => 115641)
--- trunk/Source/WebCore/loader/cache/CachedImage.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/loader/cache/CachedImage.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -65,7 +65,7 @@
// This method takes a zoom multiplier that can be used to increase the natural size of the image by the zoom.
IntSize imageSizeForRenderer(const RenderObject*, float multiplier); // returns the size of the complete image.
- void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor = 1);
+ void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
void removeClientForRenderer(RenderObject*);
virtual void didAddClient(CachedResourceClient*);
Modified: trunk/Source/WebCore/platform/graphics/GeneratedImage.h (115640 => 115641)
--- trunk/Source/WebCore/platform/graphics/GeneratedImage.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/platform/graphics/GeneratedImage.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -42,7 +42,7 @@
virtual bool usesContainerSize() const { return true; }
virtual bool hasRelativeWidth() const { return true; }
virtual bool hasRelativeHeight() const { return true; }
- virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor = 1);
+ virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
virtual IntSize size() const { return m_size; }
Modified: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (115640 => 115641)
--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -74,9 +74,9 @@
imageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect);
}
-void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor)
+void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
- Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio, scaleFactor);
+ Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
intrinsicRatio = FloatSize();
}
Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (115640 => 115641)
--- trunk/Source/WebCore/platform/graphics/Image.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -167,10 +167,9 @@
startAnimation();
}
-void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor)
+void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
intrinsicRatio = size();
- intrinsicRatio.scale(1 / scaleFactor);
intrinsicWidth = Length(intrinsicRatio.width(), Fixed);
intrinsicHeight = Length(intrinsicRatio.height(), Fixed);
}
Modified: trunk/Source/WebCore/platform/graphics/Image.h (115640 => 115641)
--- trunk/Source/WebCore/platform/graphics/Image.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/platform/graphics/Image.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -101,7 +101,7 @@
virtual bool usesContainerSize() const { return false; }
virtual bool hasRelativeWidth() const { return false; }
virtual bool hasRelativeHeight() const { return false; }
- virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor = 1);
+ virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
virtual IntSize size() const = 0;
IntRect rect() const { return IntRect(IntPoint(), size()); }
Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp (115640 => 115641)
--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -76,7 +76,7 @@
return IntSize((int)(fabsf(rotWidth) + 0.5f), (int)(fabsf(rotHeight) + 0.5f));
}
-void PDFDocumentImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float)
+void PDFDocumentImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
// FIXME: If we want size negotiation with PDF documents as-image, this is the place to implement it (https://bugs.webkit.org/show_bug.cgi?id=12095).
Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h (115640 => 115641)
--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -59,7 +59,7 @@
virtual void destroyDecodedData(bool /*destroyAll*/ = true) { }
virtual unsigned decodedSize() const { return 0; }
- virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor = 1);
+ virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
virtual IntSize size() const;
PDFDocumentImage();
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (115640 => 115641)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -1081,6 +1081,7 @@
EFillSizeType type = fillLayer->size().type;
IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize);
+ imageIntrinsicSize.scale(1 / image->imageScaleFactor(), 1 / image->imageScaleFactor());
RenderView* renderView = view();
switch (type) {
case SizeLength: {
@@ -1299,10 +1300,11 @@
int imageHeight = imageSize.height() / style->effectiveZoom();
RenderView* renderView = view();
- int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight, renderView));
- int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth, renderView));
- int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight, renderView));
- int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth, renderView));
+ float imageScaleFactor = styleImage->imageScaleFactor();
+ int topSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().top(), imageHeight, renderView)) * imageScaleFactor;
+ int rightSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().right(), imageWidth, renderView)) * imageScaleFactor;
+ int bottomSlice = min<int>(imageHeight, valueForLength(ninePieceImage.imageSlices().bottom(), imageHeight, renderView)) * imageScaleFactor;
+ int leftSlice = min<int>(imageWidth, valueForLength(ninePieceImage.imageSlices().left(), imageWidth, renderView)) * imageScaleFactor;
ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
ENinePieceImageRule vRule = ninePieceImage.verticalRule();
Modified: trunk/Source/WebCore/rendering/style/StyleCachedImageSet.cpp (115640 => 115641)
--- trunk/Source/WebCore/rendering/style/StyleCachedImageSet.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImageSet.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -88,7 +88,7 @@
void StyleCachedImageSet::computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
- m_bestFitImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio, m_imageScaleFactor);
+ m_bestFitImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
}
bool StyleCachedImageSet::usesImageContainerSize() const
Modified: trunk/Source/WebCore/rendering/style/StyleCachedImageSet.h (115640 => 115641)
--- trunk/Source/WebCore/rendering/style/StyleCachedImageSet.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImageSet.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -69,6 +69,7 @@
virtual void addClient(RenderObject*);
virtual void removeClient(RenderObject*);
virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const;
+ virtual float imageScaleFactor() const { return m_imageScaleFactor; }
private:
StyleCachedImageSet(CachedImage*, float imageScaleFactor, CSSImageSetValue*);
Modified: trunk/Source/WebCore/rendering/style/StyleImage.h (115640 => 115641)
--- trunk/Source/WebCore/rendering/style/StyleImage.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/rendering/style/StyleImage.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -62,6 +62,7 @@
virtual void removeClient(RenderObject*) = 0;
virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const = 0;
virtual WrappedImagePtr data() const = 0;
+ virtual float imageScaleFactor() const { return 1; }
ALWAYS_INLINE bool isCachedImage() const { return m_isCachedImage; }
ALWAYS_INLINE bool isPendingImage() const { return m_isPendingImage; }
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (115640 => 115641)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2012-04-30 15:42:28 UTC (rev 115641)
@@ -280,7 +280,7 @@
return rootElement->intrinsicHeight().isPercent();
}
-void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float)
+void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
if (!m_page)
return;
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (115640 => 115641)
--- trunk/Source/WebCore/svg/graphics/SVGImage.h 2012-04-30 15:33:19 UTC (rev 115640)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h 2012-04-30 15:42:28 UTC (rev 115641)
@@ -70,7 +70,7 @@
virtual void setContainerSize(const IntSize&);
virtual bool usesContainerSize() const { return true; }
- virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor = 1);
+ virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
virtual bool dataChanged(bool allDataReceived);