Title: [119274] trunk
Revision
119274
Author
[email protected]
Date
2012-06-01 13:20:33 -0700 (Fri, 01 Jun 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=87774
REGRESSION (r105515): reflection masks are truncated at zoom levels < 1
-and corresponding-
<rdar://problem/11387506>

Reviewed by Simon Fraser.

Source/WebCore: 

paintNinePieceImage() expects un-zoomed results from 
calculateImageIntrinsicDimensions(). This was previously addressed by having 
paintNinePieceImage() divide the effective zoom out of the result from 
calculateImageIntrinsicDimensions(). However, that results in buggy behavior for 
generated images and images with percentage sizes. In the end it seems best to 
just send a parameter to calculateImageIntrinsicDimensions() indicating whether 
the caller wants the result to be scaled by the effective zoom when appropriate.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
* rendering/RenderBoxModelObject.h:
(RenderBoxModelObject):

LayoutTests: 

* fast/reflections/reflection-with-zoom.html: Added.
* platform/mac/fast/reflections/reflection-with-zoom-expected.png: Added.
* platform/mac/fast/reflections/reflection-with-zoom-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119273 => 119274)


--- trunk/LayoutTests/ChangeLog	2012-06-01 20:15:15 UTC (rev 119273)
+++ trunk/LayoutTests/ChangeLog	2012-06-01 20:20:33 UTC (rev 119274)
@@ -1,3 +1,16 @@
+2012-06-01  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=87774
+        REGRESSION (r105515): reflection masks are truncated at zoom levels < 1
+        -and corresponding-
+        <rdar://problem/11387506>
+
+        Reviewed by Simon Fraser.
+
+        * fast/reflections/reflection-with-zoom.html: Added.
+        * platform/mac/fast/reflections/reflection-with-zoom-expected.png: Added.
+        * platform/mac/fast/reflections/reflection-with-zoom-expected.txt: Added.
+
 2012-06-01  Stephen Chenney  <[email protected]>
 
         Another Chromium test expectation update per the bug 88124.

Added: trunk/LayoutTests/fast/reflections/reflection-with-zoom.html (0 => 119274)


--- trunk/LayoutTests/fast/reflections/reflection-with-zoom.html	                        (rev 0)
+++ trunk/LayoutTests/fast/reflections/reflection-with-zoom.html	2012-06-01 20:20:33 UTC (rev 119274)
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+    body {
+        zoom: 0.75;
+    }
+    img {
+        border: 1px solid black;
+        -webkit-box-reflect: below 1px -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(white));
+    }
+</style>
+</head>
+
+<body>
+    <img src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/fast/reflections/reflection-with-zoom-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/reflections/reflection-with-zoom-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/reflections/reflection-with-zoom-expected.txt (0 => 119274)


--- trunk/LayoutTests/platform/mac/fast/reflections/reflection-with-zoom-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/reflections/reflection-with-zoom-expected.txt	2012-06-01 20:20:33 UTC (rev 119274)
@@ -0,0 +1,8 @@
+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 (6,6) size 788x588
+      RenderText {#text} at (0,0) size 0x0
+layer at (6,6) size 253x224
+  RenderImage {IMG} at (0,0) size 253x224 [border: (1px solid #000000)]

Modified: trunk/Source/WebCore/ChangeLog (119273 => 119274)


--- trunk/Source/WebCore/ChangeLog	2012-06-01 20:15:15 UTC (rev 119273)
+++ trunk/Source/WebCore/ChangeLog	2012-06-01 20:20:33 UTC (rev 119274)
@@ -1,3 +1,27 @@
+2012-06-01  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=87774
+        REGRESSION (r105515): reflection masks are truncated at zoom levels < 1
+        -and corresponding-
+        <rdar://problem/11387506>
+
+        Reviewed by Simon Fraser.
+
+        paintNinePieceImage() expects un-zoomed results from 
+        calculateImageIntrinsicDimensions(). This was previously addressed by having 
+        paintNinePieceImage() divide the effective zoom out of the result from 
+        calculateImageIntrinsicDimensions(). However, that results in buggy behavior for 
+        generated images and images with percentage sizes. In the end it seems best to 
+        just send a parameter to calculateImageIntrinsicDimensions() indicating whether 
+        the caller wants the result to be scaled by the effective zoom when appropriate.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
+        (WebCore::RenderBoxModelObject::calculateFillTileSize):
+        (WebCore::RenderBoxModelObject::paintNinePieceImage):
+        * rendering/RenderBoxModelObject.h:
+        (RenderBoxModelObject):
+
 2012-06-01  Julien Chaffraix  <[email protected]>
 
         Prepare table collapsed border computation to support mixed directionality on row group

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (119273 => 119274)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-06-01 20:15:15 UTC (rev 119273)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-06-01 20:20:33 UTC (rev 119274)
@@ -977,7 +977,7 @@
     return IntSize(size.width(), solutionHeight);
 }
 
-IntSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const IntSize& positioningAreaSize) const
+IntSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const IntSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNot) const
 {
     // A generated image without a fixed size, will always return the container size as intrinsic size.
     if (image->isGeneratedImage() && image->usesImageContainerSize())
@@ -1001,7 +1001,8 @@
 
     IntSize resolvedSize(intrinsicWidth.isFixed() ? intrinsicWidth.value() : 0, intrinsicHeight.isFixed() ? intrinsicHeight.value() : 0);
     IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0);
-    resolvedSize.scale(style()->effectiveZoom());
+    if (shouldScaleOrNot == ScaleByEffectiveZoom)
+        resolvedSize.scale(style()->effectiveZoom());
     resolvedSize.clampToMinimumSize(minimumSize);
 
     if (!resolvedSize.isEmpty())
@@ -1030,7 +1031,7 @@
     StyleImage* image = fillLayer->image();
     EFillSizeType type = fillLayer->size().type;
 
-    IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize);
+    IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);
     imageIntrinsicSize.scale(1 / image->imageScaleFactor(), 1 / image->imageScaleFactor());
     RenderView* renderView = view();
     switch (type) {
@@ -1241,13 +1242,13 @@
     LayoutUnit rightWithOutset = rect.maxX() + rightOutset;
     IntRect borderImageRect = pixelSnappedIntRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset);
 
-    IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size());
+    IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom);
 
     // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any.
     styleImage->setContainerSizeForRenderer(this, imageSize, style->effectiveZoom());
 
-    int imageWidth = imageSize.width() / style->effectiveZoom();
-    int imageHeight = imageSize.height() / style->effectiveZoom();
+    int imageWidth = imageSize.width();
+    int imageHeight = imageSize.height();
     RenderView* renderView = view();
 
     float imageScaleFactor = styleImage->imageScaleFactor();

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (119273 => 119274)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-06-01 20:15:15 UTC (rev 119273)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-06-01 20:20:33 UTC (rev 119274)
@@ -272,8 +272,10 @@
     virtual bool isBoxModelObject() const { return true; }
 
     IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositioningAreaSize) const;
-    IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaledPositioningAreaSize) const;
 
+    enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom };
+    IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
+
     RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
         bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to